Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
g_rect
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel Bourgault
g_rect
Commits
f83fc5a2
Commit
f83fc5a2
authored
Aug 17, 2015
by
Pascal Bourgault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout de paramètres optionnels pour g_viz_field et g_stabilize + un GUI pour g_rect.
parent
6508a91f
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
831 additions
and
0 deletions
+831
-0
src/g_rect/g_rect_paramsGui.fig
src/g_rect/g_rect_paramsGui.fig
+0
-0
src/g_rect/g_rect_paramsGui.m
src/g_rect/g_rect_paramsGui.m
+725
-0
src/utilities/g_rgb2gray.m
src/utilities/g_rgb2gray.m
+106
-0
No files found.
src/g_rect/g_rect_paramsGui.fig
0 → 100644
View file @
f83fc5a2
File added
src/g_rect/g_rect_paramsGui.m
0 → 100644
View file @
f83fc5a2
This diff is collapsed.
Click to expand it.
src/utilities/g_rgb2gray.m
0 → 100644
View file @
f83fc5a2
function
I
=
g_rgb2gray
(
X
)
%G_RGB2GRAY Convert RGB image or colormap to grayscale.
% G_RGB2GRAY converts RGB images to grayscale by eliminating the
% hue and saturation information while retaining the
% luminance.
%
% If RGB2GRAY exists in the Matlab path, it overrides this function and
% uses the one from the toolbox instead.
%
% I = G_RGB2GRAY(RGB) converts the truecolor image RGB to the
% grayscale intensity image I.
%
% NEWMAP = G_RGB2GRAY(MAP) returns a grayscale colormap
% equivalent to MAP.
%
% Class Support
% -------------
% If the input is an RGB image, it can be uint8, uint16, double, or
% single. The output image I has the same class as the input image. If the
% input is a colormap, the input and output colormaps are both of class
% double.
%
% Example
% -------
% I = imread('board.tif');
% J = rgb2gray(I);
% figure, imshow(I), figure, imshow(J);
%
% [X,map] = imread('trees.tif');
% gmap = rgb2gray(map);
% figure, imshow(X,map), figure, imshow(X,gmap);
%
% See also IND2GRAY, NTSC2RGB, RGB2IND, RGB2NTSC, MAT2GRAY.
% Original file: Copyright 1992-2013 The MathWorks, Inc.
% And some changes by me.
if
exist
(
'rgb2gray'
,
'file'
)
I
=
rgb2gray
(
X
);
else
X
=
parse_inputs
(
X
);
origSize
=
size
(
X
);
% Determine if input includes a 3-D array
threeD
=
(
ndims
(
X
)
==
3
);
% Calculate transformation matrix
T
=
inv
([
1.0
0.956
0.621
;
1.0
-
0.272
-
0.647
;
1.0
-
1.106
1.703
]);
coef
=
T
(
1
,:);
if
threeD
%RGB
% Do transformation
if
isa
(
X
,
'double'
)
||
isa
(
X
,
'single'
)
% Shape input matrix so that it is a n x 3 array and initialize output matrix
X
=
reshape
(
X
(:),
origSize
(
1
)
*
origSize
(
2
),
3
);
sizeOutput
=
[
origSize
(
1
),
origSize
(
2
)];
I
=
X
*
coef
'
;
I
=
min
(
max
(
I
,
0
),
1
);
%Make sure that the output matrix has the right size
I
=
reshape
(
I
,
sizeOutput
);
elseif
isa
(
X
,
'uint8'
)
% Transforms to double to do the transformations as some functions are
% not available without the Image Processing toolbox.
I
=
uint8
(
g_rgb2gray
(
double
(
X
)/
255
)
*
255
);
elseif
isa
(
X
,
'uint16'
)
I
=
uint16
(
g_rgb2gray
(
double
(
X
)/
255
)
*
255
);
end
else
I
=
X
*
coef
'
;
I
=
min
(
max
(
I
,
0
),
1
);
I
=
[
I
,
I
,
I
];
end
end
%%%
%Parse Inputs
%%%
function
X
=
parse_inputs
(
X
)
if
ismatrix
(
X
)
if
(
size
(
X
,
2
)
~=
3
||
size
(
X
,
1
)
<
1
)
error
(
' images:rgb2gray:invalidSizeForColormap'
)
end
if
~
isa
(
X
,
'double'
)
error
(
' images:rgb2gray:notAValidColormap'
)
end
elseif
(
ndims
(
X
)
==
3
)
if
((
size
(
X
,
3
)
~=
3
))
error
(
' images:rgb2gray:invalidInputSizeRGB'
)
end
else
error
(
' images:rgb2gray:invalidInputSize'
)
end
%no logical arrays
if
islogical
(
X
)
error
(
' images:rgb2gray:invalidType'
)
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment