Changeset 23989 for trunk/psLib/src/imageops/psImageMap.c
- Timestamp:
- Apr 28, 2009, 11:21:56 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageMap.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageMap.c
r21183 r23989 211 211 // XXX need to supply a mask and skip the masked pixels when calculating the centroid 212 212 // this will not in general be properly weighted... 213 if (psVectorStats (map->stats, fCell, dfCell, NULL, 0)) { 213 if (!psVectorStats (map->stats, fCell, dfCell, NULL, 0)) { 214 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 215 return false; 216 } 217 218 // XXX ensure only one option is selected, or save both position and width 219 map->map->data.F32[iy][ix] = psStatsGetValue (map->stats, map->stats->options); 220 221 if (isnan(map->map->data.F32[iy][ix])) { 222 mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] = 1; 223 } else { 214 224 mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] = 0; 215 // XXX ensure only one option is selected, or save both position and width216 map->map->data.F32[iy][ix] = psStatsGetValue (map->stats, map->stats->options);217 225 218 226 // calculate the mean position and save: 219 227 psStatsInit (meanStat); 220 psVectorStats (meanStat, xCell, NULL, NULL, 0); 228 if (!psVectorStats (meanStat, xCell, NULL, NULL, 0)) { 229 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 230 return false; 231 } 221 232 xCoord->data.F32[iy][ix] = psStatsGetValue (meanStat, meanStat->options); 222 233 psStatsInit (meanStat); 223 psVectorStats (meanStat, yCell, NULL, NULL, 0); 234 if (!psVectorStats (meanStat, yCell, NULL, NULL, 0)) { 235 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 236 return false; 237 } 224 238 yCoord->data.F32[iy][ix] = psStatsGetValue (meanStat, meanStat->options); 225 } else {226 mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] = 1;227 239 } 228 240
Note:
See TracChangeset
for help on using the changeset viewer.
