개정판 16231f58
issue #0000 imagecompare 수정
- rect을 opencv에서 그려 이미지로 출력
Change-Id: I241d6b62eb8dd88ae4a970c4e531d079bbaa3602
Markus.ImageComparer/ImageCompare.cs | ||
---|---|---|
466 | 466 |
return result; |
467 | 467 |
} |
468 | 468 |
|
469 |
|
|
469 |
public System.Windows.Media.Imaging.BitmapSource CompareReturnDrawContours(System.Windows.Media.Imaging.BitmapSource OriginalbitmapFrame, System.Windows.Media.Imaging.BitmapSource TargatBitmapFrame, Color rectColor, Size? ResultImageSize = null) |
|
470 |
{ |
|
471 |
System.Windows.Media.Imaging.BitmapSource result = null; |
|
472 |
|
|
473 |
Bitmap Originalbitmap = null; |
|
474 |
Bitmap TargatBitmap = null; |
|
475 |
|
|
476 |
try |
|
477 |
{ |
|
478 |
|
|
479 |
Originalbitmap = Converter.ConvertBitmapFrameToBitmap(OriginalbitmapFrame); |
|
480 |
TargatBitmap = Converter.ConvertBitmapFrameToBitmap(TargatBitmapFrame); |
|
481 |
|
|
482 |
var bitmap = CompareReturnDrawContours(Originalbitmap, TargatBitmap, rectColor, ResultImageSize); |
|
483 |
|
|
484 |
result = CreateBitmapSourceFromBitmap(bitmap); |
|
485 |
} |
|
486 |
catch (Exception) |
|
487 |
{ |
|
488 |
throw; |
|
489 |
} |
|
490 |
finally |
|
491 |
{ |
|
492 |
Originalbitmap.Dispose(); |
|
493 |
TargatBitmap.Dispose(); |
|
494 |
} |
|
495 |
|
|
496 |
return result; |
|
497 |
} |
|
498 |
|
|
499 |
public System.Drawing.Bitmap CompareReturnDrawContours(System.Drawing.Bitmap Originalbitmap, System.Drawing.Bitmap TargatBitmap, Color rectColor, Size? ResultImageSize = null) |
|
500 |
{ |
|
501 |
System.Drawing.Bitmap result = null; |
|
502 |
|
|
503 |
try |
|
504 |
{ |
|
505 |
Size resultImageSize = Originalbitmap.Size; |
|
506 |
|
|
507 |
if (ResultImageSize.HasValue) |
|
508 |
{ |
|
509 |
resultImageSize = ResultImageSize.Value; |
|
510 |
} |
|
511 |
|
|
512 |
var data = MathchesImageData(Originalbitmap, TargatBitmap, resultImageSize); |
|
513 |
result = GetContoursImage(data, resultImageSize, rectColor); |
|
514 |
} |
|
515 |
catch (Exception ex) |
|
516 |
{ |
|
517 |
throw ex; |
|
518 |
} |
|
519 |
finally |
|
520 |
{ |
|
521 |
} |
|
522 |
|
|
523 |
return result; |
|
524 |
} |
|
470 | 525 |
protected override void Dispose(bool disposing) |
471 | 526 |
{ |
472 | 527 |
base.Dispose(disposing); |
내보내기 Unified diff