Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hydra-image-processor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
hydra-image-processor
Commits
9ea7a85c
Commit
9ea7a85c
authored
9 years ago
by
sundar
Browse files
Options
Downloads
Patches
Plain Diff
NormalizedHistogram implementation
parent
e3917d78
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/MATLAB/NormalizedHistogram.m
+38
-0
38 additions, 0 deletions
src/MATLAB/NormalizedHistogram.m
with
38 additions
and
0 deletions
src/MATLAB/NormalizedHistogram.m
0 → 100644
+
38
−
0
View file @
9ea7a85c
function
histo
=
NormalizedHistogram
(
ImageIn
,
numBins
,
device
,
useMatlab
)
% Creates a normalized histogram array with numBins bins between min/max values.
% If min/max is not provided, the min/max of the type is used.
if
(
~
exist
(
'device'
,
'var'
)
||
isempty
(
device
))
device
=
1
;
end
if
(
~
exist
(
'useMatlab'
,
'var'
)
||
isempty
(
useMatlab
))
useMatlab
=
false
;
end
if
(
~
useMatlab
)
[
numCudaDevices
,
memoryStats
]
=
CudaMex
(
'DeviceCount'
);
if
(
numCudaDevices
<
1
)
useMatlab
=
true
;
elseif
(
device
>
numCudaDevices
)
device
=
numCudaDevices
;
end
% do something smart here if there is not enough memory...
end
sz
=
size
(
ImageIn
);
ImageIn_matlab
=
reshape
(
ImageIn
,
sz
(
1
)
*
sz
(
2
)
*
sz
(
3
),
1
);
if
(
useMatlab
)
if
(
numBins
==
0
)
histo
=
imhist
(
ImageIn_matlab
)
.
/
sum
(
imhist
(
ImageIn_matlab
));
else
histo
=
imhist
(
ImageIn_matlab
,
numBins
)
.
/
sum
(
imhist
(
ImageIn_matlab
,
numBins
));
end
%figure, plot(histo), title('Normalized Histogram Output from Matlab');
else
histo
=
CudaMex
(
'NormalizedHistogram'
,
ImageIn
,
numBins
,
device
);
%figure, plot(histo), title('Histogram Output from Cuda');
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment