How do i tell if an image has a shadow or not?

I'm currently working on a project to detect and remove shadows from an image assuming all my input images have shadows. Input images are those that have definite shadows (i.e) easy to determine that it really is a shadow just by looking at the image. My professor wants me to first find out if an image has a true shadow or not. If it does then proceed with the shadow detection and removal. I have no idea how to do this. Any thoughts?

2 Comments

Wild idea: Ask your professor.
Ofcourse i did. if he did tell me how it's supposed to be done, i would'nt be asking here would i?

Sign in to comment.

Answers (2)

9 Comments

I don't have a problem in detecting the shadows from an image. My professor wants to know how i'm sure that it's a shadow. As in this is literally the eg he gave me: Suppose you have an image of a forest with some part of it black because it caught fire or something. Since that appears black, will you call that a shadow? I'm not even sure how to respond to that
"I don't have a problem in detecting the shadows from an image."
Then you have no problem answering the professor "I implemented such-and-such a method from such-and-such an article, where they talked about the problem of false shadows and illustrated this-and-that".
If you did not do the above then you have not detected shadows, you have detected shadow-like areas, in which case you do have a problem in detecting the shadows from an image.
So again I refer you to scholar.google.com where you can do hours or days of research until you find the answer.
There is no Mathworks provided routine for shadow detection, (though there are some File Exchange contributions for that purpose) so what you are asking is a research question, not a question about MATLAB. Here, we answer questions about MATLAB.
Shadows change hourly. Charring by fire does not. Look at hourly photos.
Charuleelaa has asked a totally fair question for this forum. I've been stumped by questions like this before. I often wonder what image processing techniques are available to identify features that are easy for humans to see, but I don't know how to code it.
Charuleelaa, can you upload an example image? Are you given the angle of illumination? Since there's only one light source all the shadows should presumably be going in the same direction. I wonder if you could detect edges of potential shadows and then look at the angle of the edges and see if they're aligned with the sun.
His question is not one about MATLAB. It is about image processing. Answers in not an image processing forum, but about MATLAB.
No, Chad, in this forum we answer questions about MATLAB, not questions about what algorithms might be used for something. When the user decides on an algorithm then we can answer questions about whether there is already a routine that implements it, and when the user encounters implementation problems we assist them with those.
The question that was posed was independent of programming language. The user could have intended to program in Applescript and the question would have been the same. That makes the question inappropriate for here.
Beginners don't know what is or isn't possible with Matlab. If someone needs to solve a problem in Matlab but doesn't know where to begin, the Matlab forum is a great place to ask.
I do some image processing and I often have to deal with shadows in satellite images. I think Charuleelaa's question is a great one. I have not seen a solution to this problem before, but if someone chimes in with an idea I'd love to hear it. I'm on this forum to learn and to help others learn. I'm not sure why some members of this forum have appointed themselves gatekeepers to let only experts in.
Often people post pictures here and ask about how to measure something (diameter, angle, whatever). Sometimes they'll take a stab at solving it themselves, usually, for some unfathomable reason, it involves (inappropriately) edge detection as the first step. If it's simple, I'll show them how to use the proper MATLAB toolbox functions to make the measurements. About 99% of image processing boils down to just this: somehow process the image to get it to where the regions you want can be identified by thresholding, then threshold and call regionprops(). If it's a more complicated question like this one on shadow removal that involves substantial algorithm development, I'll refer them to Vision Bibliography which will almost certainly have a bunch of papers where people have published algorithms that do what they want to do. So I don't consider the question itself out of line since it may be solved with some simple MATLAB functions that they just don't happen to know about yet. However if they're asking something really tough, and often they may not know if their problem is tough or not until we tell them, then I'll just refer them to the literature and ask them to come back with code. They rarely do, though sometimes they come back with a paper and no code, and ask how to implement the paper. Usually it would require way too much of my time so I just refer them to the FAQ.
Chad, in the last 24 hours, there has been activity on 339 Questions, excluding any which have been closed or deleted. That's plenty to go around for anyone who wants to answer, expert or not. I assure you, if I see one beginner answering another beginner on a MATLAB question, my reaction is "Thanks, that saved me the trouble of answering myself!" When someone new comes along and starts answering questions, I might peek in to be sure they are doing a reasonable job of answering, but if they are not making mistakes, I let them be.
Saying that this forum is about MATLAB is nothing to do with "expert" or not: it is about limited resources; it is about "appropriate venue", and it is about trying to keep the resource clear so that people who are looking for MATLAB material can find it easily.
Imagine the scenario in which it becomes known that this is a place where people can post their vague questions about their homework or honours project, and that they would get responses telling them what approach to take. It would not be just the people dealing with MATLAB who would come here: it would be the people dealing with C, C++, C#, Java, Excel python, and many other programming languages as well. It would become a homework / project tutoring center for... well, just about any topic not prohibited by law (e.g., cryptography.) "I have a project in architecture, what should I do?" "I have a project in composites (e.g., cement), what should I do?" "How do I graph this sinking loan in Excel?" You have an interest in satellite photography, but maybe someone else has an interest in sociology with an intent to do statistical analysis in SPSS, so why should we allow general discussions about satellite photography but not general discussions about statistical analysis?
You are, in short, asking that this resource be allowed to become a combination Stackoverflow and ResearchGate.
Are you familiar with The Tragedy of the Commons ? "The tragedy of the commons is an economic theory of a situation within a shared-resource system where individual users acting independently and rationally according to their own self-interest behave contrary to the common good of all users by depleting that resource."
"In addition, Hardin also pointed out the problem of individuals acting in rational self-interest by claiming that if all members in a group used common resources for their own gain and with no regard for others, all resources would still eventually be depleted. Overall, Hardin argues against relying on conscience as a means of policing commons, suggesting that this favors selfish individuals – often known as free riders – over those who are more altruistic. "
The response that we have developed is that we restrict access to the resource to those matters that have to do with MATLAB (and Simulink.) If someone has a question about what is available in the Mathworks libraries, we answer. If someone has a question about how MATLAB works, we answer. If someone has a bug related to their MATLAB implementation, we answer. But if someone wants us to find an algorithm for them, or wants us to read papers and explain them, then we say "Google is that-a-way; come back when you have a MATLAB question."
The Answers facility is not self-cleaning. People spend time behind the scenes throwing away the junk; redirecting to other resources; asking people to clarify questions; reformatting questions to be readable; telling people we won't do their homework for them; searching for questions with common themes and tagging them consistently; testing and commenting on File Exchange Contributions. My personal limit is adjusting tags on about 85 Questions or Contributions in a batch, and it isn't going to be more than 25 unless there is a ready supply of chocolate (or ice cream) in the house. The gatekeeping and the janitor work is a lot of work -- but it is also necessary to keep the resource useful.

Sign in to comment.

MHN
MHN on 23 Mar 2016
Edited: MHN on 23 Mar 2016
It is like someone come here and ask you how can I do face detection with Matlab! There are 88,500 of papers (search it in google scholar), and thousands of researchers putting years of their life to answer this question and increase accuracy of their algorithms. It is exactly the same with your question! If you are a green researcher in this field, start with theory and algorithms, then try to implement the current methods. Then if you have a question about implementation in Matlab come and ask us. I believe the link that @Walter Roberson has sent is the best answer to your question.

3 Comments

Face detection has a specific answer, the Viola-Jones detector in Computer Vision Toolbox.
Yes, but this method has its problems e.g. overlapping of sub windows. And he said "My professor wants me ...." so it means it should be a new (modified) method! If his boss (in a company) asked him for doing face detection, then yes Viola-Jones detector in Computer Vision Toolbox is the answer for the face detection task. Anyway, this kind of question exists and I still believe your answer was the best (link to the Google Scholar).
We had someone the other day asking for a way to check to see that there really was a face where VJ detected it. That has close similarities to this present Question, being open-ended, the topic of a lot of research over the years, with no real answer (and what exactly is a "face" anyhow?)

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!