gil::color_converted_view
에 쓰는 것이 기본보기의 데이터에 영향을 미치지 않는다는 것을 깨달았습니다. 그것이 맞는지 궁금하네요?boost :: gil :: color_converted_view with boost :: gil :: for_each_pixel
예를 들어, 적색 채널의 값을 받아 파란색 채널의 값을 절반으로 설정하는 프로그램을 작성한다고 가정 해 봅시다. SrcView
실제로 gil::rgb8_view_t
때
template <typename SrcView>
void half_red_to_blue(SrcView & view)
{
// Since SrcView might be RGB or BGR or some other types,
// I decided to use a color_converted_view to ensure that I'm
// accessing the correct channels
typedef gil::color_converted_view_type<SrcView, gil::rgb8_pixel_t>::type MyView;
MyView my_view = gil::color_converted_view<gil::rgb8_pixel_t>(view):
struct my_lambda
{
void operator()(gil::rgb8_pixel_t & p)
{
p[2] = p[0]/2;
}
};
gil::for_each_pixel(my_view, my_lambda());
}
그러나에만 작동 : 여기 내 시도가 실패한입니다. 전화하면 (예 : half_red_to_blue<gil::bgr8_view_t>(view)
,보기가 전혀 변경되지 않습니다! 디버거에서 약간 검사를하고 쓰기 작업이 원본 픽셀 대신 프록시 위치에 쓰는 것 같습니다.
아이디어가 있으십니까? 미리 감사드립니다!