Changeset 20991
- Timestamp:
- Dec 14, 2008, 2:48:22 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081214/psphot/src/psphotSourceSize.c
r20978 r20991 3 3 4 4 // XXX This should be a recipe variable 5 # define SN_LIMIT 5.05 # define SN_LIMIT 3.0 6 6 7 7 static float psphotModelContour(const psImage *image, const psImage *weight, const psImage *mask, … … 330 330 int xe = pixels->numCols; 331 331 for (int ix = xo; ix >= 0; ix--) { 332 if (mask->data.U8[yo][ix] & maskVal) { 333 continue; 334 } 332 335 float SN = pixels->data.F32[yo][ix] / sqrt(weight->data.F32[yo][ix]); 333 336 if (SN < SN_LIMIT) { 334 xs = ix + 1;335 337 break; 336 338 } … … 338 340 psVectorAppend (xf, (float) ix); 339 341 psVectorAppend (yf, (float) yo); 342 xs = ix; 340 343 } 341 344 for (int ix = xo + 1; ix < pixels->numCols; ix++) { 345 if (mask->data.U8[yo][ix] & maskVal) { 346 continue; 347 } 342 348 float SN = pixels->data.F32[yo][ix] / sqrt(weight->data.F32[yo][ix]); 343 349 if (SN < SN_LIMIT) { 344 xe = ix;345 350 break; 346 351 } … … 348 353 psVectorAppend (xf, (float) ix); 349 354 psVectorAppend (yf, (float) yo); 350 } 351 psphotVisualShowCRMask (xf, yf); 355 xe = ix + 1; 356 } 357 // psphotVisualShowCRMask (xf, yf); 358 // fprintf (stderr, "first line: %d : %d - %d\n", yo, xs, xe); 352 359 353 360 int startXs = xs; … … 369 376 // first, try all of the pixels in the valid range (xs < x < xe guaranteed to be real pixels) 370 377 for (int ix = xs; ix < xe; ix++) { 378 if (mask->data.U8[iy][ix] & maskVal) { 379 continue; 380 } 371 381 float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]); 372 382 if (SN < SN_LIMIT) { … … 383 393 // next, try the pixels to the left of the valid range for the previous row 384 394 for (int ix = xs - 1; ix >= 0; ix--) { 395 if (mask->data.U8[iy][ix] & maskVal) { 396 continue; 397 } 385 398 float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]); 386 399 if (SN < SN_LIMIT) { 387 newXs = ix + 1;388 400 break; 389 401 } … … 392 404 psVectorAppend (xf, (float) ix); 393 405 psVectorAppend (yf, (float) iy); 406 newXs = ix; 394 407 } 395 408 396 409 // finally, try the pixels to the right of the valid range for the previous row 397 410 for (int ix = xe; ix < pixels->numCols; ix++) { 411 if (mask->data.U8[iy][ix] & maskVal) { 412 continue; 413 } 398 414 float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]); 399 415 if (SN < SN_LIMIT) { 400 newXe = ix;401 416 break; 402 417 } … … 405 420 psVectorAppend (xf, (float) ix); 406 421 psVectorAppend (yf, (float) iy); 407 } 422 newXe = ix + 1; 423 } 424 // fprintf (stderr, "down line: %d : %d - %d\n", iy, newXs, newXe); 408 425 409 426 xs = newXs; 410 427 xe = newXe; 411 428 } 412 psphotVisualShowCRMask (xf, yf);429 // psphotVisualShowCRMask (xf, yf); 413 430 414 431 xs = startXs; … … 430 447 // first, try all of the pixels in the valid range (xs < x < xe guaranteed to be real pixels) 431 448 for (int ix = xs; ix < xe; ix++) { 449 if (mask->data.U8[iy][ix] & maskVal) { 450 continue; 451 } 432 452 float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]); 433 453 if (SN < SN_LIMIT) { … … 444 464 // next, try the pixels to the left of the valid range for the previous row 445 465 for (int ix = xs - 1; ix >= 0; ix--) { 466 if (mask->data.U8[iy][ix] & maskVal) { 467 continue; 468 } 446 469 float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]); 447 470 if (SN < SN_LIMIT) { 448 newXs = ix + 1;449 471 break; 450 472 } … … 453 475 psVectorAppend (xf, (float) ix); 454 476 psVectorAppend (yf, (float) iy); 477 newXs = ix; 455 478 } 456 479 457 480 // finally, try the pixels to the right of the valid range for the previous row 458 481 for (int ix = xe; ix < pixels->numCols; ix++) { 482 if (mask->data.U8[iy][ix] & maskVal) { 483 continue; 484 } 459 485 float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]); 460 486 if (SN < SN_LIMIT) { 461 newXe = ix;462 487 break; 463 488 } … … 466 491 psVectorAppend (xf, (float) ix); 467 492 psVectorAppend (yf, (float) iy); 468 } 493 newXe = ix + 1; 494 } 495 // fprintf (stderr, "up line: %d : %d - %d\n", iy, newXs, newXe); 469 496 470 497 xs = newXs; … … 472 499 } 473 500 474 psphotVisualShowCRMask (xf, yf);501 // psphotVisualShowCRMask (xf, yf); 475 502 psFree (xf); 476 503 psFree (yf);
Note:
See TracChangeset
for help on using the changeset viewer.
