Question: I need a new centered 2D array (new width(x,col) == new height(y,row)) * For example, if the width(x,col) is 20 pixels greater than the height(y,row),

I need a new "centered" 2D array (new width(x,col) == new height(y,row))

* For example, if the width(x,col) is 20 pixels greater than the height(y,row), this should return a height x height image, with 10 pixels removed from the left and right edges of the image

* If the number of pixels to be removed is odd, remove 1 fewer pixel from the left or top part.

Code below:

for(var row = 0; row < imageData.length; row++)

for(var col = 0 + value/2; col

{

temp.imageData[row][col] = imageData[row][col];

}

}

How should I change my code in order to reach the requirement of the question ( If the number of pixels to be removed is odd or even) ?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!