Home > Software engineering >  GDI BMP matrix read algorithm
GDI BMP matrix read algorithm

Time:09-28

What algorithm can quickly read into this area also color matrix and the coordinates of wide, high? I write my own performance under a algorithm tried too low reading here to boot to the coordinates of 3 seconds

CodePudding user response:

Took a look at the color of the rectangular area, basic is not the same, if only the figure above, my idea is to first iterate over all pixels, using a structure to write down that point coordinates and the pixel values, add the type of the structure as a vector (several rectangular statement a few vector), and then takes these vector first and the most and an element can be the width of each rectangle is high, for reference only.

CodePudding user response:

Use PhotoShop

CodePudding user response:

refer to the second floor zhao4zhong1 response:
use PhotoShop


reference 1st floor kuangbao9 response:
looked at the color of the rectangular area, basic is not the same, if only the figure above, my idea is to first iterate over all pixels, using a structure to write down that point coordinates and the pixel values, add the type of the structure as a vector (several rectangular statement a few vector), and then takes these vector first and the most and an element can be the width of each rectangle is high, for reference only.


Wrote me a new optimized algorithm, the original is to take a single block every time the coordinate values of color area, and calculate the width and height, so poor performance, the optimized one-time after reading all the color value of coordinates, the width of the height, and then recorded so need to take a piece of color area is read directly from the record, no longer alone to compute efficiency is back to normal

CodePudding user response:

reference 1st floor kuangbao9 response:
looked at the color of the rectangular area, basic is not the same, if only the figure above, my idea is to first iterate over all pixels, using a structure to write down that point coordinates and the pixel values, add the type of the structure as a vector (several rectangular statement a few vector), and then takes these vector first and the most and an element can be the width of each rectangle is high, for reference only.


Because itself is to locate the coordinate different colors with the coordinates of the figure, rectangle represents the color coordinates

CodePudding user response:

Longyin_
reference 4 floor response:
Quote: refer to 1st floor kuangbao9 response:

Took a look at the color of the rectangular area, basic is not the same, if only the figure above, my idea is to first iterate over all pixels, using a structure to write down that point coordinates and the pixel values, add the type of the structure as a vector (several rectangular statement a few vector), and then takes these vector first and the most and an element can be the width of each rectangle is high, for reference only.


Because itself is to locate the coordinate different colors with the coordinates of the chart, these color rectangle represents the coordinate
  • Related