Changeset 30957
- Timestamp:
- Mar 18, 2011, 5:48:39 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/psLib/src/imageops/psImageBackground.c
r30956 r30957 95 95 } else { 96 96 // 2011/03/16 - MWV: Hmmm... this overwites the previously defined Npixels that only counted finite-valued pixels. 97 Npixels = nx * ny; 97 Npixels = nx * ny; 98 98 99 99 // Subsample all pixels … … 108 108 // 2) Go through this ordering up to Nsubset to select pixels 109 109 psVector *frndPixelOrder = psVectorAlloc(Npixels, PS_TYPE_F32); 110 for (long i = 0; i < Npixels; i++) { 111 frndPixelOrder->data.F32[i] = psRandomUniform(rng); 110 for (long i = 0; i < Npixels; i++) { 111 frndPixelOrder->data.F32[i] = psRandomUniform(rng); 112 112 } 113 113 // Now sort the array so that we end up with a list of the pixels in random order … … 115 115 // Now loop in our new sorted order 116 116 // Paul Price suggests fixing this up so that it gets all Nsubset pixels, skipping over the masked ones. 117 // This would be implemented with a while loop. I'm leaving this comment-out till I test the simpler version that just makes this one conceptual change. 118 // Ah, we can just use n 119 int i=0; 120 while ((n < Nsubset) && (i < Npixels)) { 121 i++; 122 // for (long i = 0; i < Nsubset; i++) { 117 for (long i = 0; n < Nsubset && i < Npixels; i++) { 123 118 int pixel = frndSortedPixelOrder->data.S32[i]; 124 119 int ix = pixel % nx;
Note:
See TracChangeset
for help on using the changeset viewer.
