04-17-2007 03:19 PM
Hi,
I have a problem with CVI 8.0.1 under XP. I want to programmatically put a
picture as a background in a graph control (.bmp, .png or .jpg) but I have an
error message in debug mode that tell me "Not enough memory" and in
release mode nothing appear in my graph control. Is there a way to avoid that?
04-18-2007 02:24 AM
Hello Domp,
what method are you using to put the picture on your graph? I usually use the functions below:
plot = PlotBitmap (pnlHandle, PNL_GRAPH, 0.0, 0.0, 1.0, 1.0, NULL);
SetCtrlBitmap (pnlHandle, PNL_GRAPH, plot, bitmap);
04-22-2007 11:53 AM
04-22-2007 11:56 PM
04-23-2007 10:05 AM
04-23-2007 11:56 PM
How are you calculating largeur_map and hauteur_map values? According to documentation they are expressed in graph units and the image is rescaled to satisfy these values, so I imagine you may have some memory problems in this operation. I suggest you pass 0 as these parameters to check that the image is loaded correctly: after this is done you may proceed to calculate correct values and pass them to the function.
11-05-2013 10:15 PM
hi
how to convert bitmap image into graphical data points?
thanks in advance,
manju
11-05-2013 11:18 PM
Hello manju,
Please do not revive old threads to ask a different thing.
What do you intend to do? Canyou give us some more data on your problem?
11-06-2013 02:49 AM
hi
I need to get a bitmap image(having a sine wave or some other waveforms) and I need to plot that image in a graph.
So from bitmap image, can i extract graphical data points?
I used the following function.
GetBitmapFromFile
PlotBitmap
SetCtrlBitmap
With GetBitmapFromFile function I can get the bitmap image and and while using PlotBitmap, image is exactly pasting in the graph.
I cant extract data points(like amplitude phase) from that graph.
Finally is there any option for converting bitmap image to graphical data values.
thanks in advance,
Manju
11-06-2013 05:06 AM - edited 11-06-2013 05:07 AM
I was afraid you want meaning something like that...
First of all, are you considering the error involved in such a process? The image (a hard copy of the screen, I suppose) is intrinsically limited to the screen resolution, since the actual graph on screen cannot resolve less then one pixel on each direction so plotting a curve intrinsically introduces some rounding (it's something like having a set of double values and extracting only the integer part for further analysis!).
Coming to the operative part, I have no real experience on analizing an image so I can only propose some guidelines mainly from a theorical point of view.
You must load the image content in memory with GetBitmapInfo and GetBitmapData, next you will need to scan the image column-by-column and find the trace point (detecting it based on the color? on the contrast with adjacent pixels?). Since the image in memory is no more than a matrix of pixel colors, you could rebuild the trace data from this process; remapping the trace to the appropriate scales will give you back the measures (subject to the aproximation error I told you before).
While analyzing the image, be aware that bits array is shaped in row-major order so you will need some transposing to easily scan it per columns. See the help for the Bits parameter in GetBitmapData.
I can see an additional problem if the drawing process has created more than one point on the single column, for example due to some aliasing or if the original trace has been drawn with "thick pen" like PlotXY with Plot Style = fat line.