Good day, gentlemen! The essence of the question is as follows: I process the photo pixel by pixel:
Bitmap bit = new Bitmap(StartImage); Size size = bit.Size; for (int y = 0; y < size.Height; y++) for (int x = 0; x < size.Width; x++) { Color c = bit.GetPixel(x, y); ... Некоторые действия с пикселем ... } It took the opportunity to exclude some areas from the processing area. Well, I thought that, supposedly, a garbage question: now let's input an array of points that we don’t need to process, but before getting a pixel and processing it
if (ExceptPoints.Contains(new Point(x,y))) and it's in the hat! But it was not there. The method began to work just to hell slowly (and when I selected half of the entire image for testing, I didn’t wait for the result for 4 minutes). I tried to implement multithreading to solve this problem. But I almost burned down the CPU (99% of the load). In general, you need to somehow optimize this thing (or implement non-cluttered multithreading), but there’s no idea how to do this. So I appeal to you for advice on this difficult matter!
PS - exclusion areas are initially set in circles with a random radius. But what to check, whether the point enters one of the circles, what to check if it is among the array containing all points of these circles, one thing comes out in time
HashSet<Point>, the search in it should be almost instant. - VladDGetPixel, and useLockBits(there’s an example below). - VladD