Ask Your Question

titan1432's profile - activity

2020-04-05 12:08:27 -0500 received badge  Notable Question (source)
2018-09-30 10:31:36 -0500 received badge  Popular Question (source)
2016-09-12 11:25:51 -0500 received badge  Self-Learner (source)
2016-03-05 00:57:18 -0500 received badge  Popular Question (source)
2015-01-22 17:13:47 -0500 commented answer Read grayscale image into array

Thanks, it works! Last question - can I somehow avoid conversion (in order to improve performance)?

2015-01-22 17:12:26 -0500 received badge  Supporter (source)
2015-01-22 17:12:25 -0500 received badge  Scholar (source)
2015-01-22 17:01:13 -0500 commented answer Read grayscale image into array

Thanks, but still float *b; b = img_float.data; doesn't work: cannot convert from uchar* to float*

2015-01-22 16:51:13 -0500 commented answer Read grayscale image into array

That doesn't work: 1>------ Build started: Project: test_openCV, Configuration: Debug x64 ------ 1> Source.cpp 1>Source.cpp(14): error C2065: 'CV_LOAD_IMAGE_ANYDEPTH' : undeclared identifier 1>Source.cpp(19): error C2440: '=' : cannot convert from 'uchar *' to 'float *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== So, for some reason CV_LOAD_IMAGE_ANYDEPTH doesn't work.

2015-01-22 16:30:57 -0500 asked a question Read grayscale image into array

Hi all, I am absolutely new to openCV, and I need to read tif grayscale image into array of floats in order process it with my GPU kernel. Here is the code:

#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main()
{
Mat image,image1;
string a = "C:\\programs\\misha\\pic-1.tif";
image = imread(a, CV_32F); // Read the file
float *b;
b = image.data;

return 0;
}

The error is: cannot convert from *uchar to *float. I tried to to do b = (float*)image.data, but there was a trash in array b after that.

I tried also to convert image to CV_32F. As I understand, Image.data must return me pointer to the data. I use 0-based row-major order in my GPU code. The speed of reading is also very important for me, so I need the fastest way to do it.

Thanks

2015-01-22 16:16:18 -0500 answered a question OpenCV doesn't work with VS2013

After a long time of different attempts, I found the answer here. For x64 project, in addition to what I did above, you have to:

1) Restart your PC after setting enviromental variables. Variable Path was not updated on my computer without restart.

2) In addition to libraries added above, you have to add (although, for this example some of them might not be used):

ippicvmt.lib
IlmImfd.lib
libtiffd.lib 
libpngd.lib
libjasperd.lib
libjpegd.lib
libwebpd.lib
zlibd.lib
comctl32.lib
2015-01-22 13:26:39 -0500 commented question OpenCV doesn't work with VS2013

Thanks, I did it. Cannot post an answer, since I am a newbie here

2015-01-22 12:03:03 -0500 commented question OpenCV doesn't work with VS2013

@berak, See Update, after I changed search path to correct one, and I also changed runtime option to Multithreaded debug /MTd, I got just a lot of errors of the type "Unresolved external symbol"

2015-01-22 11:47:06 -0500 commented question OpenCV doesn't work with VS2013

I tried, no changes. Still the same error

2015-01-20 15:09:22 -0500 received badge  Editor (source)
2015-01-20 15:07:55 -0500 asked a question OpenCV doesn't work with VS2013

{I solved it! will post an answer in an hour, since I am not allowed to post it earlier, than 2 days}

I just installed openCV ver. 3.00 beta on my computer and I'm trying to test it with VS2013. I followed quick start guide:

1) Installation for windows, using pre-build libraries.

2)OpenCV inside Microsoft VS, using local method and x64/vc12 directory for libraries.

I tried to build example from link #2:

#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    if (argc != 2)
    {
        cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
        return -1;
    }

    Mat image;
    image = imread(argv[1], IMREAD_COLOR); // Read the file

    if (image.empty()) // Check for invalid input
    {
        cout << "Could not open or find the image" << std::endl;
        return -1;
    }

    namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
    imshow("Display window", image); // Show our image inside it.

    waitKey(0); // Wait for a keystroke in the window
    return 0;
}

My output is:

1>------ Build started: Project: test_openCV, Configuration: Debug x64 ------
1>LINK : fatal error LNK1104: cannot open file 'opencv_calib3d300d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Additional information:

1) Project: CUDA 6.5 (I need to work with CUDA).

2) Source file: Source.cpp

3) Mode: Debug, x64.

4) Enviromental variables:

OPENCV_DIR: C:\programs\misha\opencv\build\x64\vc12

Path (the last string): %OPENCV_DIR%\bin

5) Page Properties:

C\C++ -> General -> Additional Include Directories(last string): $(OPENCV_DIR)....\include

Linker -> General -> Additional Library Directories(last string): $(OPENCV_DIR)\lib

Linker -> Input -> Additional Dependencies:

opencv_calib3d300d.lib

opencv_core300d.lib

opencv_features2d300d.lib

opencv_flann300d.lib

opencv_highgui300d.lib

opencv_imgcodecs300d.lib

opencv_imgproc300d.lib

opencv_ml300d.lib

opencv_objdetect300d.lib

opencv_photo300d.lib

opencv_shape300d.lib

opencv_stitching300d.lib

opencv_superres300d.lib

opencv_ts300d.lib

opencv_video300d.lib

opencv_videoio300d.lib

opencv_videostab300d.lib

I also tried to use x86 version with x32 project and OpenCV ver. 2.4

!! If you use VS2013 and can build this example (or at least any example with openCV libs), can you please send me your project? My e-mail is [email protected]. I will figure it out by myself!!

Update: I tried to change this option:

Linker -> General -> Additional Library Directories(last string): $(OPENCV_DIR)\staticlib

So instead of lib I used staticlib, the directory where all this libs are, and I got about 700 unresolved external symbols. Thanks, Mikhail

2015-01-20 12:23:57 -0500 asked a question OpenCV doesn't work with VS2013

My question is described on stackoverflow

Please help. I tried to do a lot of things - but I cannot force it to work.