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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 How to cut out a ROI from an image
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

carsten

Switzerland
78 Posts

Posted - 02/28/2005 :  10:05:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 02/28/2005 :  10:14:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

carsten

Switzerland
78 Posts

Posted - 02/28/2005 :  11:12:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 02/28/2005 :  11:47:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

carsten

Switzerland
78 Posts

Posted - 02/28/2005 :  12:31:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Mike for your quick reply. This is exactly what I need!

Carsten
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000