I have a binary image of the hand (size: 100x100), we can represent it as a matrix which is only 0 Or 1 value is an example:
< / P>
assuming that I have the line In other words, I need to calculate the weighted sum of each pixel of the array, Is the following code more efficient than the last one? The answer is - you do not really have to worry about it at this juncture. If your code is slow also is running, you can experiment with some customization, however, "very slow" is subjective. Premature Optimization is the root cause of all evils . Is easily readable, and can be easily maintained. double represent the linear image, and that we call it the
image , I need to do the following :
Double Conservator = 0; For (int j = 0; j and lt; image; height; ++ j) {accumulator + = image [j] * weight [j]; }
the image I
weight to an array Indicates that there are
double values, and it is used to load each pixel of the image.
Double Container = 0; (Int j = 0; j & lt; image.Length; ++ j) {if (image [j]! = 0) {creditor = = image [j] * weight [j]; }}
No comments:
Post a Comment