Overlay

1 개요

다른 이미지와 Overlay 연산을 수행하는 알고리즘입니다. Source 이미지의 위에 Operand 이미지의 픽셀 값이 0이 아닌 경우 Operand 이미지를, 0인 경우 Source 이미지를 출력하는 연산을 수행합니다.

2 알고리즘 상세 설명

Source Operand Result
Source Operand Operand result
Fig. Overlay 수행 결과 1

Source Operand Result
Source Operand Operand result
Fig. Overlay 수행 결과 2

3 파라미터 설정 및 사용 방법

  1. 이미지 연산 설정
    • Operand 이미지를 설정합니다.

    • API

      SetOperandImage(Base::CFLImage);
      
    • 예제 코드

      COperationOverlay Overlay;
      CFLImage fliSourceImage;
      CFLImage fliOperandImage;
      CFLImage fliDestinationImage;
      
      // 지정된 경로에서 이미지 로드
      if(fliSourceImage.Load(L"../../ExampleImages/OperationOverlay/Sea.flif").IsFail())
      	break;
      if(fliOperandImage.Load(L"../../ExampleImages/OperationOverlay/Moon.flif").IsFail())
      	break;
      
      Overlay.SetSourceImage(fliSourceImage);
      // Operand 이미지 설정
      Overlay.SetOperandImage(fliOperandImage);
      Overlay.SetDestinationImage(fliDestinationImage);
      
      // 알고리즘 수행
      if(Overlay.Execute().IsFail())
      	break;
      
      // 수행된 결과 이미지를 저장
      if(fliDestinationImage.Save(L"../../ExampleImages/OperationOverlay/Result.flif").IsFail())
      	break;
      
      COperationOverlay Overlay = new COperationOverlay();
      CFLImage fliSourceImage = new CFLImage();
      CFLImage fliOperandImage = new CFLImage();
      CFLImage fliDestinationImage = new CFLImage();
      
      // 지정된 경로에서 이미지 로드
      if(fliSourceImage.Load("../../ExampleImages/OperationOverlay/Sea.flif").IsFail())
      	break;
      if(fliOperandImage.Load("../../ExampleImages/OperationOverlay/Moon.flif").IsFail())
      	break;
      
      Overlay.SetSourceImage(ref fliSourceImage);
      // Operand 이미지 설정
      Overlay.SetOperandImage(ref fliOperandImage);
      Overlay.SetDestinationImage(ref fliDestinationImage);
      
      // 알고리즘 수행
      if(Overlay.Execute().IsFail())
      	break;
      
      // 수행된 결과 이미지를 저장
      if(fliDestinationImage.Save("../../ExampleImages/OperationOverlay/Result.flif").IsFail())
      	break;