We help IT Professionals succeed at work.

graphics and xy plotter

hi experts

I make a program to load jpg, bmp files......now I desire to print the image but towards xy plotter.
The plotter moves by (x,y) axes coordinates, how I obtain from an image (x,y) coordinates to send a my plotter??

thanks for all

sorry my english :(
Comment
Watch Question

Commented:
It depends on what you want to plot.

Do you want to trace the edges of an image, or do you want to draw a direct copy of the bitmap?

Think about it for a moment, how would you manually move the plotter to create the image you are trying to plot. Then let us know so we can offer some advice.

Author

Commented:
Thanks Andyclap!

I need 2 options of trace:
  a) edges of an imagen
  b)draw a direct copy of the bitmap

what can I do? any idea ??

thanks sincerely

Author

Commented:

Author

Commented:
help!!!!!!!!!!!!!

Author

Commented:
pls!!
help!
im desesperate
thanks for all

Commented:
I think some more information would be helpful:

What sort of driver do you have for the plotter device?
- Do you send out ascii/simple binary commands to it via a COM/LPT port?
- is there a printer driver available?
- Do you know how to control it already and are looking for image processing hints?

Do you know about image processing in VB
- GetPixel in a picturebox?
- windows GDI?
- Safearray and copymemory?

Do you know any image processing mathematical techniques?
- filter functions using matrix based filters for edge detection?
- colour space transforms, e.g. RGB -> Greyscale, dithering?


It's an interesting topic, but I really need to know how much you already know before delving into it. It's also not at all simple to do from VB, so you're not going to get a quick answer such as "Use the Picture.plotit function"

Have you tried contacting the device manufacturer for information - they can often be quite helpful (is this a homemade device even? I built a simple plotter using Lego Mindstorms a few months ago - terribly wobbly output though).

Author

Commented:
andyclap

Thanks for helpme AndyClap

>>What sort of driver do you have for the plotter device?
I want make the driver, send ascii xy via serial port.

>>Do you know about image processing in VB
no,

>>Do you know any image processing mathematical techniques?
no, any web page or book about of mathematical tecniques???

Im from scratch.

pls help me :)

e^x thanks!!!



Author

Commented:
???

Author

Commented:
???
Commented:
Hi - sorry I haven't commented recently, I've more or less given up with EE as it took up too much of my time for too little reward (and the system's pretty buggy).

It's really too big a topic to go into too much detail, but to give you some ideas, here's some (untested) code:

add a picturebox to a form, set its picture to the one you want, and a command button to start plotting. Add a mscomm control to communicate with the plotter, and set its communication properties appropriately

- in the command button procedure, do something like:
private sub command1_click

  dim x as single
  dim y as single
  dim c as long

  mscomm1.portOpen=true
  for x=picture1.scaleleft to picture1.scalewidth step screen.twipsperpixelx
    for y=picture1.scaletop to picture1.scaleheight step screen.twipsperpixely
      c=picture1.point(x,y)
      PlotPixel x,y,x
    next
  next
  mscomm1.portOpen=false

end sub

public sub PlotPixel(byval x as single, byval y as single, byval c as long)
  'simple greyscale random dither
  'if a random value (0-255) > the greyscale
  'draw a little square. This gives very poor results, but better
  'than a stright threshold value.
  'Mind you if you use a photo editor to manipulate your picture to a 2 colour
  'pciture, you could use
  '  if greyscale(c)<128 then
  'instead
  if greyscale(c)<int(rnd*255) then
     PlotterMove x,y
     PlotterPen true
     PlotterMove x+1,y
     plottermove x+1,y+1
     plottermove x,y+1
     plottermove x,y
     plotterpen false
  end if
end sub

Public sub PlotterMove(byval x as single, byval y as single)
  'you'll need to do your plotter protocol code here
  WaitForComm
  mscomm1.output="MOVE " & x & " " & y
end sub

public sub PlotterPen(byval bDown as boolean)
  'again replace with protocol to move pen up/down
  WaitForComm
  mscomm1.output "PEN " & iif(bDown,"DOWN","UP")
end sub

public sub WaitForComm

  'wait for everything to be transmitted
  'assuming the plotter doesn't have a buffer
  do while mscomm1.outbuffercount>0
    doevents
  loop

end sub

public function greyscale(byval c as long) as long

   'returns a greyscale value R+G+B/3 (0 to 255)
   greyscale=c and &hff&
   greyscale=greyscale + (c and &hff00&)/&h100&
   greyscale=greyscale + (c and &hff0000&)/&h10000&

   greyscale=greyscale/3

end function

Explore More ContentExplore courses, solutions, and other research materials related to this topic.