VB code to scan pictures

M

mahadevan.swamy

I have been assigned a task where there is picture (blue print of
sensor patterns) in excel and when a blue print of a part is placed
on top of this picture, it should produce a significant output stating
where the sensors should go on or off and then assign values to the
sensor. Is there a way to capture data from scanning this image?
Thanks in advance

Swamy
 
N

NickHK

If you are talking about comparing regions/pixels in graphics, then Excel is
probably not the right environment as such.
Do you mean something like OCR - Optical Character Recognition ?
I really do not understand what you mean by "produce a significant output
stating where the sensors should go on or off and then assign values to the
sensor".

NickHK
 
M

mahadevan.swamy

There are two layouts. One layout is the sensor layout where the
sensors are oriented in a circle and the other layout is the part
layout which consists of some big and small circles. The part layout
is going to be placed on top of this sensor layout. From there, all
the 32 sensors has to read the part pattern properly and each sensor
has to give an output such as 0, 1, and X. 0 means the part is not
covering the sensor, 1 means the part is covering the sensor, and X
means the part is partially covering the sensor.

Excel may not be the right environment to do this but how can I solve
this problem? This requires creating some decision logic to scan the
layouts and decide. Please let me know if you have any more questions.
Thanks

Swamy
 
N

NickHK

So you mean that from a picture, you have to calculate the position of a
certain element of that picture, some kind of graphic pattern matching ?
Whilst VBA with the GDI/GDI+/DirectX API can do it, you would need to read
on the concepts behind the techniques.

As such, it is not an Excel question until you have some aspect of the code
that is giving you trouble.
Maybe some of these will help
http://www.google.co.uk/search?q=image+processing+VB+-net&btnG=Search&hl=en

If you know the coordinates to examine, the process will be more easier, but
by no means simple.

Unless I have missed the point, which is quite possible...

If you can get the designs in some vector format (AutoCAD, Illustrator etc),
it would be much easier, as then the locations of the elements is exposed.

NickHK
 
M

mahadevan.swamy

Thanks for your suggestion. I work with CATIA (a CAD program) and I am
not sure how to capture data when reading this drawing. Since I have
the sensor layout in excel, i was hoping i could use macros to perform
some function. But i think this scanning process is highly
complicated. Even CATIA too have macros functionality but i dont know
how to use them. what do you mean by putting design in some vector
format?
 
N

NickHK

Please confirm that initially you were thinking of working with pictures (as
in bmp, jpg etc) to match the positions ?
If so, this is difficult for the reason I explained.

If you have the coordinates in some numerical form, then Excel is an option.

I don't use CAD app much, but I know you can automate AutoCAD (and it has
VBA ?), so access the positions, properties etc of the elements.
No idea about CATIA, but according to http://en.wikipedia.org/wiki/CATIA
<Quote>
The application programming interfaces supported are as follows:
The Fortran and C programming languages for version 4 (V4).
The Visual Basic and C++ programming languages for version 5 (V5).

These APIs are referred to as CAA for V4 and CAA2 (or CAA V5) for V5. The
CAA2 are component object model (COM) based interfaces. They provide
integration for products developed on the CATIA suite of software."
</Quote>

Maybe you should look at that.

NickHK
 
M

mahadevan.swamy

If you know the coordinates to examine, the process will be more easier, but
by no means simple.

Well, now I have the co-ordinates of the sensors and the layout. The
part layout consists of holes and I have co-ordinates for that. In
excel, I have one row full of co-ordinates (x, y, r) for each hole.
The logic is if the sensor is within the range of the hole, it should
be a 0. If the sensor is not within the range of the hole, it should
be a 1 or if the sensor is blocked by the hole, it should be an X. I
have used some formulas to calculate for one hole and a sensor but the
problem is I have 32 sensors and I want to scan the data from the
entire row and then compute the results. I would appreciate if anyone
has some feedback on how I should approach this problem. Thanks

Mahadevan Swamy
 
N

NickHK

You need some kind of Hit Test, based on the Sensor(x,y,r) and the
Hole(x,y,r) and determine the degree of overlap, if any.
Then repeat for each hole in you list.
Depends somewhat on what you mean by "if the sensor is within the range of
the hole".

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top