Hi. I want to be able to load a large tiff (say 1000 x 1000) and manually select a smaller ROI (e.g. 50x50) and display this new reduced image (but not by binning).
I have experimented with
imshow('c:\funny.bmp');
h = imrect;
pos = h.getPosition()
but after I create the rectangle and then move it, the coordinates do not change. I am not sure how to: 1 create an "onmove" call back to ouptut the coordinates 2: Then take these and create the smaller image from the larger on (and display it) Thanks Jason

 採用された回答

Image Analyst
Image Analyst 2011 年 8 月 1 日

0 投票

Why not consider rbbox()? There is a nice example in the help for it.

その他の回答 (2 件)

Sean de Wolski
Sean de Wolski 2011 年 8 月 1 日

0 投票

Look at the first example in the
doc imrect
documentation file. A few small changes to the callback function and you'll be all set.

3 件のコメント

Jason
Jason 2011 年 8 月 1 日
Yes I did read this, but didn't understand the addNewPositionCallback. I assume this is the key line.
figure, imshow('cameraman.tif');
h = imrect(gca, [10 10 100 100]);
addNewPositionCallback(h,@(p) title(mat2str(p,3)));
fcn = makeConstrainToRectFcn('imrect',get(gca,'XLim'),get(gca,'YLim'));
setPositionConstraintFcn(h,fcn);
Sean de Wolski
Sean de Wolski 2011 年 8 月 1 日
addNewPositionCallback(h,@(p)assignin('base','pos',p));
This line is what to do with the new position. Here I assigned it to the base workspace as 'pos'. You could assign it somewhere else, save it, display it, etc.
Jason
Jason 2011 年 8 月 1 日
Thanks Sean. I liked the rbbox option more as it seemed more elegant. But I do want to thank you for your help as well, I know have 2 ways.
Thankyou again.
Jason

サインインしてコメントする。

Asad Alam
Asad Alam 2021 年 2 月 22 日

0 投票

How can we identify fixed Region of interest in every image specific for pixel[120 370 ,240 340] it should be a fixed rectangular window?

3 件のコメント

Image Analyst
Image Analyst 2021 年 2 月 22 日
What do you mean? What's to identify? You have the coordinates of the rectangular window. What else do you need/want? What's your definition of "identify"??? I would think the coordinates you gave would identify it sufficiently enough.
Asad Alam
Asad Alam 2021 年 2 月 23 日
I have 10 images in a folder i have used imagedatatore to call all of them now first i have to use 1 image processed it and then loop back for the next image then processed(processing means i have to create a rectangular window on each of thr 10 images bacically each rectangular window will be the region of interest now i have to save this cropped rectangular image and then use this image for further process) it then loop back for thi i have used while loop
Basically i want tto know how can i use indexing like selecting one image crop it then do all other processing then save it and loop back
Image Analyst
Image Analyst 2021 年 2 月 23 日
Your "Answer" doesn't sound like an "Answer" for @Jason so I suggest you read this link
and then start your own question with your images attached. In the meantime see the FAQ:

サインインしてコメントする。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by