如果我们只有图像,如何发现面积图数据?

发布于 2024-09-19 03:37:11 字数 89 浏览 6 评论 0原文

面积图(图像)有几个数据系列,这些数据系列用不同的颜色绘制。我们知道图像的大小和x轴上每个标签的坐标,是否可以通过图像识别来发现y轴的系列?有人可以透露一些信息吗?

The area chart (image) has a few data series, which are charted with different colors. We know the image size and co-ordinates of each lable on x-Axis, is it possible to discover the series of y-Axis by image recongition? Can anybody shed some light?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奈何桥上唱咆哮 2024-09-26 03:37:11

如果你知道 y 轴刻度,那应该是可以的。

要进行屏幕抓取,您可以首先使用每个系列的滤色器来过滤图像。
第二步是收集临时图像中所有剩余像素的坐标,并将它们转换为所需的比例。

给定

  • 坐标 x,y 处
  • 的像素 图表原点在图像像素中的偏移 xoffset, yoffset
  • 图表轴的比例 xscale, yscale

您可以计算该像素的数据(伪代码)

pixelData.x := (x - xoffset) * xscale
pixeldata.y := (y - yoffset) * yscale

然后,如果您的系列线进行一些插值大于一个像素宽(例如获取单列左右所有像素的平均数据)。

更新1:用于简单颜色过滤器过滤红色图表的伪代码

//set up desired color levels to filter out
redmin := 240;
redmax := 255
bluemin := 0;
bluemax := 0;
greenmin := 0
greenmax := 0;

//load source bitmap
myBitmap := LoadBitmap("Chartfile.bmp");

//loop over bitmap pixels
for iX := 0 to myBitmap.width-1 do
  for iY := 0 myBitmap.height-1 do
    begin  
      myColorVal := myBitmap.GetPixels(iX, iY);
      //if the pixel color is inside your target color range, store it
      if ((mycolorVal.r >=redmin) and (myColorVal.r <= redmax)) and
         ((mycolorVal.g >=greenmin) and (myColorVal.g <= greenmax)) and
         ((mycolorVal.b >=bluemin) and (myColorVal.b <= bluemax)) then 
         storeDataValue(iX, iY); //performs the value scaling operation mentioned above
    end;

If you know the y-axis scale, it should be possible.

To screenscrape, you could first filter your image with a color filter for each of the series.
Second step would be to gather the coordinates of all remaining pixels in your temporary image and transform them these to the scale needed.

given

  • a pixel at coordinates x,y
  • the offset of the charts Origin in image pixels xoffset, yoffset
  • the Scale of you chart axis xscale, yscale

you could calculate the data for this pixel (pseudocode)

pixelData.x := (x - xoffset) * xscale
pixeldata.y := (y - yoffset) * yscale

And afterwards, do some interpolation if your series line is more then one pixel wide (for example get the average data for all pixels in a single column or so).

Update1: Pseudocode for naive color filter filtering out red charts

//set up desired color levels to filter out
redmin := 240;
redmax := 255
bluemin := 0;
bluemax := 0;
greenmin := 0
greenmax := 0;

//load source bitmap
myBitmap := LoadBitmap("Chartfile.bmp");

//loop over bitmap pixels
for iX := 0 to myBitmap.width-1 do
  for iY := 0 myBitmap.height-1 do
    begin  
      myColorVal := myBitmap.GetPixels(iX, iY);
      //if the pixel color is inside your target color range, store it
      if ((mycolorVal.r >=redmin) and (myColorVal.r <= redmax)) and
         ((mycolorVal.g >=greenmin) and (myColorVal.g <= greenmax)) and
         ((mycolorVal.b >=bluemin) and (myColorVal.b <= bluemax)) then 
         storeDataValue(iX, iY); //performs the value scaling operation mentioned above
    end;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文