Channel Insertion
1 개요
여러 이미지의 채널을 추출하여 하나의 이미지에 삽입하는 알고리즘입니다.
2 알고리즘 상세 설명
각 삽입 이미지에서 설정한 채널을 추출하여, 이를 하나의 소스 이미지의 각 색인에 배치하고 대상 이미지에 설정합니다.
설정한 삽입 이미지의 수와 소스 이미지의 채널 수 만큼 대상 이미지의 채널이 생성됩니다.
예시
3개의 4채널 삽입 이미지에 대해 각각 0, 2, 2채널이 선택하여 4 채널 소스 이미지의 0, 1, 2번 색인에 삽입하면 대상 이미지는 7 채널 이미지가 생성됩니다.
- 대상 이미지의 결과
- 0 채널 : 첫 번째 삽입 이미지의 0 채널
- 1 채널 : 소스 이미지의 0 채널
- 2 채널 : 두 번째 삽입 이미지의 2 채널
- 3 채널 : 소스 이미지의 1 채널
- 4 채널 : 세 번째 삽입 이미지의 2 채널
- 5 채널 : 소스 이미지의 2 채널
- 6 채널 : 소스 이미지의 3 채널
아래는 1채널 이미지 2장의 0번 채널을 1채널 이미지의 1번 색인에 삽입해 3채널 이미지로 생성하는 예시입니다.
Source |
Insertion 1 |
 |
 |
Insertion 2 |
Result |
 |
 |
Source |
Insertion 1 |
Insertion 2 |
Result |
 |
 |
 |
 |
Fig. Channel Insertion 동작 예시
3 예제
CChannelInsertion channelInsertion;
CFLImage fliSourceImage;
channelInsertion.SetSourceImage(fliSourceImage);
CFLImage fliDestinationImage;
channelInsertion.SetDestinationImage(fliDestinationImage);
CFLImage fliInsertionImage0;
CFLImage fliInsertionImage1;
CFLArray<CFLImage*> flaInsertionImages;
flaInsertionImages.PushBack(&fliInsertionImage0);
flaInsertionImages.PushBack(&fliInsertionImage1);
CFLArray<int64_t> flaChannels;
flaChannels.PushBack((int64_t)EChannelSelection_Channel_0);
flaChannels.PushBack((int64_t)EChannelSelection_Channel_0);
CFLArray<int64_t> flaIndices;
flaIndices.PushBack((int64_t)0);
flaIndices.PushBack((int64_t)0);
channelInsertion.SetInsertionImage(flaInsertionImages);
channelInsertion.SetInsertionChannel(flaChannels);
channelInsertion.SetInsertionIndex(flaIndices);
channelInsertion.Execute();
CChannelInsertion channelInsertion = new CChannelInsertion();
CFLImage fliSourceImage = new CFLImage();
channelInsertion.SetSourceImage(ref fliSourceImage);
CFLImage fliDestinationImage = new CFLImage();
channelInsertion.SetDestinationImage(ref fliDestinationImage);
CFLImage fliInsertionImage0 = new CFLImage();
CFLImage fliInsertionImage1 = new CFLImage();
List<CFLImage> listInsertionImages = new List<CFLImage>();
listInsertionImages.Add(fliInsertionImage0);
listInsertionImages.Add(fliInsertionImage1);
List<Int64> listChannels = new List<Int64>();
listChannels.Add((Int64)EChannelSelection.Channel_0);
listChannels.Add((Int64)EChannelSelection.Channel_0);
List<Int64> listIndices = new List<Int64>();
listIndices.Add((Int64)0);
listIndices.Add((Int64)0);
channelInsertion.SetInsertionImage(ref listInsertionImages);
channelInsertion.SetInsertionChannel(listChannels);
channelInsertion.SetInsertionIndex(listIndices);
channelInsertion.Execute();
channelInsertion = CChannelInsertion()
fliSourceImage = CFLImage()
channelInsertion.SetSourceImage(fliSourceImage)
fliDestinationImage = CFLImage()
channelInsertion.SetDestinationImage(fliDestinationImage)
fliInsertionImage0 = CFLImage()
fliInsertionImage1 = CFLImage()
listInsertionImages = List[CFLImage]()
listInsertionImages.Add(fliInsertionImage0)
listInsertionImages.Add(fliInsertionImage1)
listChannels = List[Int64]()
listChannels.Add(int(EChannelSelection.Channel_0))
listChannels.Add(int(EChannelSelection.Channel_0))
listIndices = List[Int64]()
listIndices.Add(0)
listIndices.Add(0)
channelInsertion.SetInsertionImage(listInsertionImages)
channelInsertion.SetInsertionChannel(listChannels)
channelInsertion.SetInsertionIndex(listIndices)
channelInsertion.Execute()