Image processing shape area calculation

Posted on 2001-07-10
Last Modified: 2008-03-17
I need a software tool that can calculate the area of a solid object in a digital image.  This will be used to measure the difference in area of two shadows.

Any ideas of where I can find such a solution?

I'm asking this question for a couple of co-op students at my work, so budget is basically nonexistent.  Thanks!
Question by:porear
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
LVL 22

Expert Comment

ID: 6272641
Actually I wanted to create such a thing a while again. Not similar, but from a face. ANd it is pretty damn hard to create such a thing. Since you need to check the whole image, and assume where objects may be located in the image. What shadows may be, etc etc. The closest examples I got to examine in my own project where some samples from a medical institute. Hospitals use such programs but those images are easier. They are black, and only the bones of people show up. Without knowing what objects are on the image it is (almost) impossible to know where and how big shadows are supposed to be. I think you are out of luck, just like me  (*pouts*). You'd better look into a graphical SDK like DirectX to create a scene and use the LPDIRECT3DVERTEXBUFFER to create objects and calculate the size etc etc. From a digital image I'd say impossible...


Expert Comment

ID: 6283369
Actually it's hard, but I wouldn't say impossible.
I don't know any commertial program that do what you want but I can help you develop the algorithm if you will give me more details about the nature of your images (what they contain, what is the background, do you have a picture without the shadows of the same backgound, etc.)
Good Luck...

Author Comment

ID: 6293832
I really don't have much more and have been unable to contact those who need it.  I know the basics are this:

These guys are trying to measure the difference in surface area of a shadow cast in 2 test cases.

The first case involves draping a covering over an object, and letting it "fluff out" at the bottom at what could be called the "hem of the skirt".

The second case involves wrapping a restraint at the bottom such that the hem is bound closely to the covered object.

Presently these guys are tracing the shadows on paper, cutting them out, and weighing the cutouts to obtain a ratio in shadow size, but we thought there had to be a better way (this is for the space program, for Pete's sake! ;).

Sorry, thats all I have.  Thanks for your time, if nothing else we'll let them continue on their current path.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 22

Expert Comment

ID: 6293842
Nothing to add from my side....sorry...


Expert Comment

ID: 6295021
I just want to make sure I understood you well.
These guys actually photograph the object (image1), then put some "skirt" on it and try to measure the amount of pixels of the shadowed object, which are the pixels from the part of the object that can still be seen in the image but now covered with shadow.
Now they change the state of the "skirt" and measure this shadow again, and then calculate the difference.
The problem is then, how to know what is a "shadowed object" pixel and what not ?

I'll have to assume that the image contains only the object or have a totally black background otherwise this will be a much more complicated story.

Am I right so far ?

Author Comment

ID: 6296404
At present they are not using digital images, but are tracing the shadows on paper to weigh.  

They are not looking for shadows on the object itself, only the shadow cast below the object from a light source above with the covering in its loose and bound configurations.  

For an analogy:  imagine a table with a long tablecloth draped over.  Look at its shadow on the floor.  Now take a cord and wrap around the tablecloth at the bottom, and observe the shadow on the floor again.

I would assume that for photos a white background could be used, such that pixels in shadow will have stark contrast.

Accepted Solution

ygal02 earned 100 total points
ID: 6297507
If so I believe the problem is not so hard.
Assuming you photographed the state of the floor before (I1) and after (I2) the change in the shadows you have to do the following:
1. in order to eliminate camera and movement noise (as much as possible) perform a gausian blur (say with 5 pixels size filter)
2. I3 = abs(I2 - I1);
3. m = mean(I3);
4. count = 0
5. foreach pixel (x,y) of I3:
        if I3(x,y) > m
            count = count + 1;
6. print "the diference in shadow is :", count
7. end

The trick here is to take the avarege difference as a treshold and assume that major changes in the intensity level ar related to the shadow.
In different conditions the algorithm might need to be changes slightly (for example for big images or very noisy one you might want to take a bigger gausian filter, etc.)
You can write the whole thing in c/c++ but I personaly recommands MATLAB, which will make your life much easier.

Good Luck.

Author Comment

ID: 6317219
Thanks for the help.  I've got no time at the moment to actually throw this together, but i I can nab a resource I'll pass the algorithm along.

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sp_configure 'external scripts enabled', 1; 7 157
Getting Variable not defined error in Python 1 81
Survey branching tutorial 11 77
Java Inheritance super keyword use 8 72
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question