Answer the question
In order to leave comments, you need to log in
How to remove stripe from pixels in bitmap?
Good afternoon. I write Seam Carving and everything is ready except for one thing, how to remove pixels and display this change on the pictureBox and eventually save.
There is an EnergyMat matrix, a dist (distance) sum matrix, and an array of the shortest path way.
If we reduce the image by n pixels, then in the loop we shift all subsequent pixels to the left from the current position.
for (int i = 0; i < height; i++)
{
for (int j = way[i]; j < width; j++)
{
EnergyMat[i, j] = EnergyMat[i, j + 1];
dist[i, j] = dist[i, j + 1];
width--;
}
}
Answer the question
In order to leave comments, you need to log in
1. Either redraw the Bitmap in the old sizes, but simply paint over the unwanted pixels with the background, or create a new Bitmap of the required sizes and reassign it to PictureBox.Image
2. You can crop only by recreating new ones and copying the values, but this will be expensive. Probably easier width--
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question