to make 5 image to be an unit using histogram
4 views (last 30 days)
Show older comments
Can help me?
How do I take 5 grayscale images, which have the different size/dimensions, be an unit using histogram?
My image grayscale:
for i = 1:5
citra1{i} = imread(['D:imageGray\' num2str(i) '.jpg']);
end
thank you for help.
5 Comments
Image Analyst
on 15 Jan 2013
That's not the error for that code. Your code is:
OneCitra=([citra3{1} citra3{2} citra3{3} citra3{4} citra3{5}]);
but the error refers to a citra1, not citra3:
OneCitra=([citra1{1} citra1{2} citra1{3} citra1{4} citra1{5}]);
You have to make sure that when you give an error message you give the actual code that generated the error message.
Accepted Answer
Walter Roberson
on 15 Jan 2013
You cannot construct your OneCitra the way you do if the images do not all have the same number of rows, or do not all have the same third dimension. (Different number of columns would be okay.)
Fortunately you do not need to construct OneCitra. Comment it out and instead use
foo = [citra1{1}(:); citra1{2}(:); citra1{3}(:); citra1{4}(:); citra1{5}(:)];
Note: the code you show does not match your error message. The code you show initializes citra1 but then uses citra3, but your error message uses citra1 as is probably proper.
3 Comments
Walter Roberson
on 15 Jan 2013
citra1{1} is your first image. (:) after that reshapes that image to a single column vector. citra1{2} is your second image, the (:) after it reshapes that second image to a single column vector; the ";" between the two parts means to use horizontal concatenation, which would produce a single column vector from the original two.
More Answers (1)
Image Analyst
on 15 Jan 2013
The problem is that when you do something like
OneCitra=([citra3{1} citra3{2} citra3{3} citra3{4} citra3{5}]);
you have to make sure that the array inside citra3(1) has the same number of rows as the arrays inside all the other cells. Evidently your images have different sizes. When you use braces like citra3{1}, it means the "contents" of the cell, in other words, the actual array itself contained in the first cell of citra3. If you use parentheses, citra3(1), it means the first cell itself, not the contents of the cell. So citra3(1) is a cell, and citra3{1} is a 2D uint8 matrix (not a cell).
0 Comments
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!