Ask Your Question

fb20's profile - activity

2019-04-19 18:36:29 -0600 received badge  Famous Question (source)
2018-10-12 07:51:04 -0600 received badge  Notable Question (source)
2018-06-29 16:08:11 -0600 received badge  Popular Question (source)
2017-03-16 23:13:53 -0600 asked a question OpenCV-3.1/build

Hi,

I am trying to build OpenCV-3.1 and I am getting a compilation error when it comes to cuda::Thrust

I am using cuda-8.0.

Is v.3.1 compatible with cuda-8.0

[ 41%] Building NVCC (Device) object modules/cudaimgproc/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gftt.cu.o
/usr/local/cuda-8.0/include/thrust/detail/reference.inl(127): error: no default constructor exists for class "thrust::detail::execute_with_allocator<cv::cuda::device::ThrustAllocator, thrust::system::cuda::detail::execute_on_stream_base>"
      detected during:
        instantiation of "void thrust::reference<Element, Pointer, Derived>::assign_from(OtherPointer) [with Element=float2, Pointer=thrust::pointer<float2, thrust::detail::execute_with_allocator<cv::cuda::device::ThrustAllocator, thrust::system::cuda::detail::execute_on_stream_base>, thrust::use_default, thrust::use_default>, Derived=thrust::use_default, OtherPointer=const float2 *]" 
(65): here
        instantiation of "thrust::reference<Element, Pointer, Derived>::derived_type &thrust::reference<Element, Pointer, Derived>::operator=(const thrust::reference<Element, Pointer, Derived>::value_type &) [with Element=float2, Pointer=thrust::pointer<float2, thrust::detail::execute_with_allocator<cv::cuda::device::ThrustAllocator, thrust::system::cuda::detail::execute_on_stream_base>, thrust::use_default, thrust::use_default>, Derived=thrust::use_default]"

Fb.

2017-03-16 20:47:21 -0600 asked a question From cv::Mat to saving image in a given format(png,jpeg...)

Hi,

I am trying to work out how to save an image in a given format (PGM, PNG, JPEG,... ) once I have constructed a cv::Mat

in Header file:

uchar *m_imageData;
uchar* getImageData() const { return m_imageData; }

in class

//c_mrcI being the object that populates m_imageData variable

in main with nxi=4096 and nyi=4096:

cv::Mat *cvmat = new cv::Mat(nxi,nyi,CV_8UC4,c_mrcI->getImageData());

Once I have cvmat I would like to display the content to screen using cvImageShow for example and then save this into a given format (PGM, PNG, JPEG, ...).

Normally I would do:

IplImage *img_jpg = cvLoadImage("some.jpg");
cvNamedWindow("some.jpg", CV_WINDOW_AUTOSIZE);
cvShowImage("some.jpg", img_jpg);
cvWaitKey();

Bu this requires to already have the image some.ext already saved on disk.

So in OpenCV how do we go from cvmat to cvShowImage with and without a disk access?

FB.