Where to start? - Calculating the size of an object (square footage) in an image
-
Hello Everyone- I have been programming with C# building database applications for a year or so. I have a new side project that I am working on and quite frankly, I don't know where to start! (I can't even figure out what to type in to google!) What I am looking for is a starting point to get me going in the right direction. I am trying to build an application that will utilize a camera, take a picture of a table with a predefined (green) background, and calculate the square footage of the piece of stone that is laid on it. Interfacing with the camera is no problem, I can tell the camera to snap pictures and access them. I want to then open up this image that the camera took and analyze it. The table will be painted green (or white or orange). The stone will be laid on top, so for the sake of this message lets say its a piece of stone on a pure white table. I want to analyze that image and figure out the area (square footage) of that piece of stone. I know that I can do the mathematical calculations based on how far the away the camera is from the table, but I'm not sure how to open up an image and read that image, and tell the area of "space that is not white". If anyone could point me in the right direction I would really appreciate it! Thanks so much in advance!
-
Hello Everyone- I have been programming with C# building database applications for a year or so. I have a new side project that I am working on and quite frankly, I don't know where to start! (I can't even figure out what to type in to google!) What I am looking for is a starting point to get me going in the right direction. I am trying to build an application that will utilize a camera, take a picture of a table with a predefined (green) background, and calculate the square footage of the piece of stone that is laid on it. Interfacing with the camera is no problem, I can tell the camera to snap pictures and access them. I want to then open up this image that the camera took and analyze it. The table will be painted green (or white or orange). The stone will be laid on top, so for the sake of this message lets say its a piece of stone on a pure white table. I want to analyze that image and figure out the area (square footage) of that piece of stone. I know that I can do the mathematical calculations based on how far the away the camera is from the table, but I'm not sure how to open up an image and read that image, and tell the area of "space that is not white". If anyone could point me in the right direction I would really appreciate it! Thanks so much in advance!
Take a look at Range Finder[^] article. recently published here on CP. Find the range of the four corners, a bit of trig and Bob's your uncle. :)
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Hello Everyone- I have been programming with C# building database applications for a year or so. I have a new side project that I am working on and quite frankly, I don't know where to start! (I can't even figure out what to type in to google!) What I am looking for is a starting point to get me going in the right direction. I am trying to build an application that will utilize a camera, take a picture of a table with a predefined (green) background, and calculate the square footage of the piece of stone that is laid on it. Interfacing with the camera is no problem, I can tell the camera to snap pictures and access them. I want to then open up this image that the camera took and analyze it. The table will be painted green (or white or orange). The stone will be laid on top, so for the sake of this message lets say its a piece of stone on a pure white table. I want to analyze that image and figure out the area (square footage) of that piece of stone. I know that I can do the mathematical calculations based on how far the away the camera is from the table, but I'm not sure how to open up an image and read that image, and tell the area of "space that is not white". If anyone could point me in the right direction I would really appreciate it! Thanks so much in advance!
First you have to figure out what format the picture was taken in. If it's RAW or BMP, then you've got nice little bytes of information for each rgb value of each pixel. If it was JPEG, then you've got to decompress it to get the pixel values. I think it might help to search for the term "threshold" in regards to picture analysis. It is basically getting rid of the colors that you don't want. Another way to find areas of the same color, since your data is basically a matrix, is to treat the column number as "x", treat the RGB value as "y", then find the change in y as x increases, along the row (aka a derivative). Then you've got an array of 0's for filled in areas of the same color, and enormous values at the border zones, and you can fill in your shape w/ whatever geometry you want to get the area. Or, if this is a long term project, you could check out Activision Tools or Euresys E-Vision. They already do this all this and much more.