Image processing shape area calculation

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!
Who is Participating?

Improve company productivity with a Business Account.Sign Up

ygal02Connect With a Mentor Commented:
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.
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...

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...
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

porearAuthor Commented:
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.
Nothing to add from my side....sorry...

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 ?
porearAuthor Commented:
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.
porearAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.