How can I crop the image at a particular location each time?
Show older comments
I have multiple rbg images. I want to analyze them for pixel calculation. But I only want a part of it. How can I crop all the images at the exact same location?
Accepted Answer
More Answers (2)
HighPhi
on 8 Feb 2022
0 votes
Your rgb images are an X x Y x 3 array,
where, visually, X is actually image height and Y is actually image width
If you imaging that the top left corner of your image is 0,0
you can get another smaller cropped area via:
rgb2 = rgb1(X1:X2, Y1:Y2, :);

David Hill
on 8 Feb 2022
Edited: David Hill
on 8 Feb 2022
Your rbg image is just a matrix. Just index into the matrix at the location you want.
x=uint8(randi(255,1000,1000,3));
imshow(x(10:10,50:80,:));
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

