The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 How to cut out a ROI from an image

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
carsten Posted - 02/28/2005 : 10:05:17 AM
Origin Version (Select Help-->About Origin): 7.5
Operating System: XP

I would like to cut out a certain area (ROI) from an image. To see what area fulfil my needs I would like to copy (cut) this ROI from within the image view. This area should then paste into a new matrix. In a second step I need to cut/copy a second area of the same size from the initial image, too. Again, this area should also paste into a second matrix. Finally I will compare these two areas (i.e. the matrices).
Is there an easy way to manage this task?

Carsten
4   L A T E S T    R E P L I E S    (Newest First)
carsten Posted - 02/28/2005 : 12:31:58 PM
Thank you Mike for your quick reply. This is exactly what I need!

Carsten
Mike Buess Posted - 02/28/2005 : 11:47:51 AM
That information is saved on the ROI matrix page. With the ROI matrix showing enter the command page.info.= from the script window. This is a typical response...

page.info.=;
<ROI>
[MAIN]
FLAG = 1.
WIN$ = "Matrix2"
TYPE$ = "Rectangle"
NROWS = 128.
NCOLS = 128.
I1 = 45.
I2 = 60.
J1 = 51.
J2 = 70.
NPIXELS = 320.

I1 and I2 are the first and last rows selected by the ROI in the matrix. J1 and J2 are the first and last columns. You can access those values individually like this...

i1=page.info.ROI.Main.I1;
i2=page.info.ROI.Main.I2;
j1=page.info.ROI.Main.J1;
j2=page.info.ROI.Main.J2;

...Those are Origin C indices which start at zero. The above example describes an ROI that covers rows 46-61 and columns 52-71 in the source matrix.

The ROI coordinates are obtained from the source matrix like this...

ROIObject ROI;
ROI = GetROI();
vector vValue;
vector<int> vi,vj;
ROI.GetRegionPoints(vValue, vi, vj);

This creates three vectors... vValue contains the values of each pixel in the region and vi, vj contain the row, column indices.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/28/2005 11:50:47 AM

Edited by - Mike Buess on 02/28/2005 12:03:46 PM
carsten Posted - 02/28/2005 : 11:12:18 AM
Thank you Mike for this hint. I already have copied this tool and I appreciate it. In order to compare different areas within an image I need to cut out always the same size of area. Therefore, at least I need the matix indices of one corner and the size of the ROI. The size can be found from the ROI matrix, but how can I get the indices of the corner easily.

Carsten
Mike Buess Posted - 02/28/2005 : 10:14:07 AM
Download this add-on from the File Exchange...

http://www.originlab.com/FileExchange/details.aspx?C=5&cid=6&fid=38

It might not accomplish everything you want but will at least copy a ROI to a new matrix.

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000