के बाद से बढ़ावा देने::गिल का समर्थन नहीं करता है gray8_view_t लेखन के लिए बीएमपी के प्रारूप में, मैं परिवर्तित करना चाहते हैं gray8_view_t करने के लिए rgb8_view_t. यहाँ है क्या मैं अब तक की कोशिश की.
auto rgb_view = boost::gil::planar_rgb_view(width, height, pixels, pixels, pixels, width);
पिक्सल में शामिल है कच्चे पिक्सल से gray8_view_t वस्तु है, तो मैं आर=g=b=पिक्सल है । लेकिन boost::gil::write_view(ofstream, rgb_view, boost::gil::bmp_tag())
मुझे एक खाली छवि । किसी भी विचार है?
अद्यतन:
का उपयोग करके sehe के उदाहरण कोड http://coliru.stacked-crooked.com/a/daa0735f774b727f, मैं प्राप्त करने में सक्षम था रंग करने के लिए बातचीत के साथ संकलित color_converted_view<gil::rgb8_view_t>
. लेकिन यह संकलन नहीं करता है जब मैं का उपयोग करें boost::gil::write_view
बनाने के लिए एक छवि फ़ाइल से वापसी मान के color_converted_view<gil::rgb8_view_t>
. मेरा अनुमान है कि मैं होगा बनाने के लिए एक वास्तविक rgb8_image_t से वस्तु के मूल्य वापसी. मैं कैसे कर सकते हैं बदलने के मूल्य वापसी color_converted_view<gil::rgb8_view_t>
करने के लिए एक वास्तविक rgb8_image_t वस्तु? धन्यवाद!
#include <boost/gil.hpp>
#include <fstream>
namespace gil = boost::gil;
int main()
{
std::ifstream in("gray8_image_t_sample.jpg", std::ios::binary);
gil::gray8_image_t img;
gil::read_image(in, img, gil::jpeg_tag());
gil::gray8_view_t gv = gil::view(img);
std::ofstream ofs1("test_image.png", std::ios::out | std::ios_base::binary);
gil::write_view(ofs1, gv, gil::png_tag()); // This works
auto rgbv = gil::color_converted_view<gil::rgb8_view_t>(gv);
std::ofstream ofs2("test_image.bmp", std::ios::out | std::ios_base::binary);
gil::write_view(ofs2, rgbv, gil::bmp_tag()); // this does not compile
}
त्रुटि संदेशों में से एक मैं कर रहा हूँ
\boost\gil\color_base_algorithm.hpp(170,76): error G1A4676F8: no member named 'layout_t' in 'boost::gil::image<boost::gil::pixel<unsigned char, boost::gil::layout<boost::mp11::mp_list<boost::gil::red_t, boost::gil::green_t, boost::gil::blue_t>, boost::mp11::mp_list<std::integral_constant<int, 0>, std::integral_constant<int, 1>, std::integral_constant<int, 2>>>>, false, std::allocator<unsigned char>>' [clang-diagnostic-error]