MATLAB Answers

How to Copy Labeled Object Area Value and Paste on Other Object

5 views (last 30 days)
Murat Kocaman
Murat Kocaman on 7 Sep 2018
Commented: Murat Kocaman on 13 Sep 2018
I am not sure if it is possible or not but would like to ask if anybody has a knowledge on copying the properties of any labeled objects to another oobject. I mean Regionprops values with properties.
An example, I am using below properties on regionprops:
and my aim is to copy the area value to pasted point.


Walter Roberson
Walter Roberson on 7 Sep 2018
So at the target location, the code should check to see if there is an existing object there and if so it should delete or add randomly to the object until the area of the resulting object was the same as the first object?

Sign in to comment.

Answers (3)

Walter Roberson
Walter Roberson on 7 Sep 2018
regionprops returns a struct. You can assign the struct or parts of it to another variable.


Sign in to comment.

Image Analyst
Image Analyst on 7 Sep 2018
Why would you want to do that? It sounds like a very bad and deceptive idea and would lead to wrong, or at best, misleading results.
You forgot to attach your input binary image, and what you want to see as the result of this (in my opinion, unwise) operation.
What is a "pasted point"? What are you pasting and how and where?
Do you simply want to display some text (in the overlay) of the area of one object but above some different object? Again, this is wrong.


Sign in to comment.

Murat Kocaman
Murat Kocaman on 10 Sep 2018
Edited: Murat Kocaman on 10 Sep 2018
I am trying to find a solution to count not counted objects and give the value of average value(Area) of the whole objects which are almost the same. I couldn't do that without fake object approach.
My image is:
The X locations are not counted ones. The red X object is the same with the 22. So I thought I am able to use it instead of that one.
What I use are Centroid, Area and Eccentricity values of the object.


Show 1 older comment
Murat Kocaman
Murat Kocaman on 11 Sep 2018
I haven't solved it yet. Now I could add the count but couldn't indicate the objects which are not able to be detected on counting.
I need to create objects on the X marked regions because there are no objects there only mark. What I need here is Area values.
So, if there is a way to create an object with circled boundary (or anything to create a similar object with the others in an image) it will solve my problem. Do you have a way if an object could be created while drawing a circle near the undetected objects?
Image Analyst
Image Analyst on 11 Sep 2018
You haven't given the "use case" for this application, and that would help guide our replies.
First of all, see if you can take photos without overexposing the subject.
Then, I'm guessing that you want to compare this thing (ring or jewelry or whatever) to a perfect version, so do you have a perfect version to compare it to?
Next, if the subject is the same for every photo, then why can't you just use imfreehand() to hand draw a template - a set of regions that define where every region should be? If all your subjects will be the same shape/structure, then a template would be the simplest approach.
Murat Kocaman
Murat Kocaman on 13 Sep 2018
I think editing your code on the manual duplicating which we have already discussed at that topic would solve the problem. I am trying to implement it thank you.
So, fake object approach become duplicating objects and because the outer objects on the above picture are the same It would be better than the first.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!