Basically , i am trying to calculate length/width of an object in image ,with cartesian graph paper in background.I have found bounding box of object.But how can i read cartesian coordinate (x,y) in background?
↧
How can we calculate length/width of an object in image?
↧
I want to create an array for the letters in the given picture in python what can i do?

↧
↧
Recognizing and reading text from an image using tesseract and opencv in c++?
I am trying to recognize text from an image and I am using Tesseract and opencv for this. The code I have used for this is below.
#include "stdafx.h"
#include
#include
#include
#include
using namespace std;
using namespace cv;
int main(int argc, char* argv[])
{
string outText;
string imPath = "Images/newspaper2.jpeg";
// Create Tesseract object
tesseract::TessBaseAPI *ocr = new tesseract::TessBaseAPI();
// Initialize tesseract to use English (eng) and the LSTM OCR engine.
ocr->Init("tessdata", "eng", tesseract::OEM_LSTM_ONLY);
// Set Page segmentation mode to PSM_AUTO (3)
ocr->SetPageSegMode(tesseract::PSM_AUTO);
// Open input image using OpenCV
Mat im = cv::imread(imPath, IMREAD_COLOR);
// Set image data
ocr->SetImage(im.data, im.cols, im.rows, 3, im.step);
// Run Tesseract OCR on image
outText = string(ocr->GetUTF8Text());
// print recognized text
cout << outText << endl; // Destroy used object and release memory ocr->End();
return EXIT_SUCCESS;
}
But I am facing an error while I am executing this. Error is ```namespace "tesseract" has no member "oem_lstm_only" ```. It is having problems in initializing tesseract to use English (eng) and the LSTM OCR engine. But I am using **```tesseract version 3.2```** only so LSTM OCR engine should work fine. Can anyone please tell me why I am getting this error and how can I solve this.
↧
Compare ROI
Hello, I need suggestions. I would like to compare the region in blue, people who have red cheeks and people who do not. I do not have a large database to use deep learning.
↧
How do I support c++11 in Opencv 3 Android NDK
Hi, all
I am doing the next changes to support c++11 with opencv 3 in android NDK:
I change from APP_STL := gnustl_static to APP_STL := c++_static
Application.mk
APP_STL := c++_static
APP_CPPFLAGS := -std=c++11 -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a mips x86 arm64-v8a x86_64 mips64
APP_PLATFORM := android-14
# use this to select gcc instead of clang
NDK_TOOLCHAIN_VERSION := 4.9
Android.mk
LOCAL_PATH := $(call my-dir)
LOCAL_PATH_LIB_DIR:=library/lib/classifier
include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=off
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
include ../../../OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_MODULE:= detection_based_tracker
LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp \
library/jniUtils.cpp \
${ LOCAL_PATH_LIB_DIR}/logic.cpp \
${ LOCAL_PATH_LIB_DIR}/logic2.cpp \
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -llog -ldl -lm -latomic -L$(LOCAL_PATH)/libs/armeabi
- L$(LOCAL_PATH)/libs/armeabi-v7a -L$(LOCAL_PATH)/libs/mips
-L$(LOCAL_PATH)/libs/x86 -L$(LOCAL_PATH)/libs/arm64-v8a
-L$(LOCAL_PATH)/libs/mips64
-L$(LOCAL_PATH)/libs/x86_64
LOCAL_CPPFLAGS += -ljnigraphics -D_LINUX -DBOOST_HAS_PTHREADS -fexceptions -std=c++11
-I$(LOCAL_PATH)/ -I$(LOCAL_PATH)/library/lib/pico/ I
LOCAL_CPP_FEATURES := exceptions rtti
APP_OPTIM := debug
include $(BUILD_SHARED_LIBRARY)
When I compile the Android app with Android NDK r10e. I hav the next errores in the Log:
error: undefined reference to
'cv::DescriptorMatcher::match(cv::_InputArray const&, cv::_InputArray const&, std::__1::vector>&, cv::_InputArray const&) const'
undefined reference to 'cv::Subdiv2D::insert(std::__1::vector,std::__1::allocator>> const&)'
error: undefined reference to 'cv::imwrite(cv::String const&, cv::_InputArray const&, std::__1::vector> const&)'
the undefined reference to cv::imwrite method, this method is in the native SDK opencv in the path
"opencv/imgcodecs.hpp"
CV_EXPORTS_W bool imwrite( const String& filename, InputArray img,
const std::vector& params = std::vector());
↧
↧
best approach to count pallet boxes in images using openCV?
[C:\fakepath\IMG-20180808-WA0034.jpg](/upfiles/15359595732002587.jpg)
↧
OpenCV with project CLR
I created project CLR (Visual Studio 2017) with all forms and elements.
On the Internet, I found the settings for the OpenCV installation, but as a result, when connecting the library #include a different list of errors is issued. I added path to the system settings and connected all the directories / libraries in the settings of a particular project.
I tried different versions of OpenCV (3.4.3, 2.4.13.6, 3.4.2). Then added library at the c++ project. But the result was similar. I tried change x86 to x64, but no result.
I apply all the screenshots of the code, settings and errors.
Here on this video the developer explicitly uses the clr project, how did he do it? https://www.youtube.com/watch?v=yg_zO4sjbYc
I will be grateful for the help! It is very necessary to deal with the problem. Thx!
↧
OpenCV Manager: Item not Found
The OpenCV docs says:> In most cases OpenCV Manager may be> installed automatically from Google> Play. For the case, when Google Play> is not available, i.e. emulator,> developer board, etc, you can install> it manually using adb tool.
According to this question: http://answers.opencv.org/question/124582/opencv-manager-for-the-320-library/
and this open issue https://github.com/opencv/opencv/issues/8120 , It's not yet available for 3.4.2 so I tried 3.0.0
and I tried 2.4.11, but none of these work.
When this code runs:
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback);
It opens the dialog saying the `OpenCV Manager is not available, do you want to install it?`
I click YES, and I get to a Google Play page where all it says is
`Item not found`
So, I have Google Play access. I assume OpenCV Manager is available there since I don't find any threads that discuss its discontinuation, but it is not found.
When I try to install the APK on my phone directly, Google Protect complains that it `doesn't recognize this developer`
Whichever version I use (2.4.x, 3.0.0, or 3.4.2) so I'm wondering: is this still the way to detect the right native package to install?
The other option is use the static installation, but as I understand it, I would need to have a specific install for each type of hardware. Is that right?
I am just getting the `Item not found` message because my hardware is not recognized?
I have a Samsung Galaxy S5, which uses a SnapDragon801, which seems to be a ARMv7A 32bit chip. That should not be a problem.
I'm trying to understand what is wrong with the Google Play install, or alternatively how to install a static version that will be compatible with multiple hardware devices.
Thanks
↧
Dense_flow
I am installing Dense_flow but I have this error
make[2]: * No rule to make target '/usr/lib/x86_64-linux-gnu/libImath.so', needed by 'extract_cpu'. Stop. make[2]: * No rule to make target '/usr/lib/x86_64-linux-gnu/libImath.so', needed by 'extract_gpu'. Stop. CMakeFiles/Makefile2:178: recipe for target 'CMakeFiles/extract_gpu.dir/all' failed make[1]: * [CMakeFiles/extract_gpu.dir/all] Error 2 make[1]: * Waiting for unfinished jobs.... CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/extract_cpu.dir/all' failed make[1]: * [CMakeFiles/extract_cpu.dir/all] Error 2 make[2]: * No rule to make target '/usr/lib/x86_64-linux-gnu/libImath.so', needed by 'libpydenseflow.so'. Stop. CMakeFiles/Makefile2:215: recipe for target 'CMakeFiles/pydenseflow.dir/all' failed make[1]: * [CMakeFiles/pydenseflow.dir/all] Error 2 make[2]: * No rule to make target '/usr/lib/x86_64-linux-gnu/libImath.so', needed by 'extract_warp_gpu'. Stop. CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/extract_warp_gpu.dir/all' failed make[1]: * [CMakeFiles/extract_warp_gpu.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: * [all] Error 2
I dont know how to install libImath.so, unable to find anything on the internet. Kindly please guide me how to install?
Specifications are Ubuntu 16.04 Opencv 3.1 I have opencv 2.4 too
↧
↧
12 bits RAW data output camera sensor, how to get raw stream by opencv?
I bought a RAW data output camera sensor, it's data sheet on this website.
https://www.leopardimaging.com/uploads/LI-USB30-IMX225C_datasheet.pdf
Then i prepare to get raw stream by opencv,
simple code like this:
int main() {
VideoCapture cap(0);
int Key;
Mat src;
if (cap.isOpened()) {
while(1){
cap.read(src);
namedWindow("capture", 0);
imshow("capture", src);
waitKey(10);
}
}
}
But a problem occurred, the raw data resolution should be 1312x992, however, the imshow image's resolution is 320x240! And color is abnormal. The screensaver blow:

I don't know how to fix the resolution problem and color problem.
So if anybody can help me. Thanks.
↧
Error during installation of built opencv with CUDA
I am trying to build opencv library from source. Here some platform information:
Ubuntu 16.04, gcc version 5.4.0, CUDA version 8
I added this flags for compilation:
-D ENABLE_CXX11=ON
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D OPENCV_EXTRA_MODULES_PATH=/home/unlut/opencvdir/opencv_contrib/modules
-D BUILD_opencv_hdf=OFF
-D WITH_CUDA=ON
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D WITH_CUBLAS=1
-D INSTALL_C_EXAMPLES=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_TESTS=OFF
First make operation is completed successfully, however, when I try to install (sudo make install), I got errors like this:
/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h(436): error: identifier "nullptr" is undefined
/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h(436): error: expected a ";"
/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h(200): error: expected a ";"
/usr/include/c++/5/exception(63): error: expected a ";"
/usr/include/c++/5/exception(68): error: expected a ";"
...
/usr/include/c++/5/bits/exception_ptr.h(64): error: function "std::current_exception" returns incomplete type "std::__exception_ptr::exception_ptr"
/usr/include/c++/5/bits/exception_ptr.h(64): error: expected a "{"
/usr/include/c++/5/bits/exception_ptr.h(79): error: expected a ";"
...
Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_0000024a_00000000-21_gpu_mat.compute_61.cpp1.ii".
Compilation terminated.
CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:266 (message):
Error generating file
/home/USERNAME/opencvdir/opencv/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o
It seems like c++11 issue however I can see -std=c++11 flag both among my c++ release and c++ debug flags. What could possibly cause this error? Thanks for taking your time to read.
↧
Error while compiling OpenCV Pre-Release 4.0.0 with CMAKE
[ 86%] Built target opencv_calib3d_pch_dephelp
[ 86%] Built target pch_Generate_opencv_calib3d [ 88%] Built target opencv_calib3d
[ 88%] Built target opencv_perf_calib3d_pch_dephelp [ 88%] Built target pch_Generate_opencv_perf_calib3d
[ 89%] Built target opencv_perf_calib3d
[ 90%] Built target pch_Generate_opencv_test_calib3d [ 92%] Built target opencv_test_calib3d
[ 92%] Built target opencv_stitching_pch_dephelp
[ 92%] Built target pch_Generate_opencv_stitching
[ 93%] Built target opencv_stitching
[ 93%] Built target opencv_test_stitching_pch_dephelp
[ 93%] Built target pch_Generate_opencv_test_stitching [ 93%] Built target opencv_test_stitching
[ 93%] Built target opencv_perf_stitching_pch_dephelp [ 94%] Built target pch_Generate_opencv_perf_stitching
[ 95%] Built target opencv_perf_stitching
[ 95%] Built target opencv_videostab_pch_dephelp [ 95%] Built target pch_Generate_opencv_videostab
[ 96%] Built target opencv_videostab [ 96%] Built target opencv_test_videostab_pch_dephelp
[ 96%] Built target pch_Generate_opencv_test_videostab [ 97%] Built target opencv_test_videostab
[ 97%] Built target gen_opencv_python_source [ 97%] Linking CXX shared module ..\..\lib\python3\cv2.cp35-win32.pyd
collect2.exe: error: ld returned 5 exit status
mingw32-make[2]: *** [modules\python3\CMakeFiles\opencv_python3.dir\build.make:104: lib/python3/cv2.cp35-win32.pyd] Error 1 mingw32-make[2]: *** Deleting file 'lib/python3/cv2.cp35-win32.pyd'
mingw32-make[1]: *** [CMakeFiles\Makefile2:7584: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2
(py3cv4) D:\Python-Virtual\OpenCV-4\opencv\opencv\build>
This is the error occuring. I'm stuck at 97% and trying to build the python module but it doesn't say anything either about what seems to be failing.
↧
CvVideoCamera in Xamarin.IOS
how to use CvVideoCamera in Xamarin.IOS or how to make CvVideoCamera as static library ??
↧
↧
I have custom C++ opencv code i would like to reuse in android how is this possible.
I have custom C++ opencv code i would like to reuse in android how is this possible.
↧
Load huge image
I try to load relativity big image 32000x32000, 3 channel but assertions raised:
Error: Assertion failed (pixels <=> (1<<30)) in> cv::validateInputImageSize, file C:\Lib\opencv\source\opencv\modules\imgcodecs\src\loadsave.cpp, line 74
OpenCV(4.0.0-pre) Error: Assertion failed ((size_t)valueInt == sz) in validateToInt, file C:\Lib\opencv\source\opencv\modules\imgcodecs\src\utils.cpp, line 48
imread_('e:/0/33333b.bmp'): can't read data: OpenCV(4.0.0-pre) C:\Lib\opencv\source\opencv\modules\imgcodecs\src\utils.cpp:48: error: (-215:Assertion failed) (size_t)valueInt == sz in function 'validateToInt'
However we can:
Mat m(65000, 40000, CV_8U);
uint64 i, n = (uint64)m.rows*m.cols;
for( i = 0; i < n; i++ )
m.data[i] = (uchar)(i & 255);
cv::threshold(m, m, 127, 255, cv::THRESH_BINARY);
imwrite("e:/0/ttt.jpg", m);
and it works fine.
This means we cant load image bigger 1 Gigapixel (UPD. by imread), but able to process and save it?
↧
Cannot load Tensorflow model with batch-normalization
Hello, i am trying to load my custom tensorflow model with help a dnn module of opencv.
Step by step:
1. I create a neural network
2. I trained it
3. I use freeze_graph.py
4. After that I use optimize_for_inference.py
5. And i use transform_graph.exe
6. Load last model in opencv dnn
But when i did't use a
> layer => tf.layers.batch_normalization(layer,> training=True)
i didn't get a error from opencv:
cv2.error: OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:1388: error: (-213:The function/feature is not implemented) Cannot determine number of parameters for batch normalization layer. in function 'cv::dnn::experimental_dnn_v5::`anonymous-namespace'::TFImporter::populateNet'
If I set
> "training = False"
then I don't get error but my model don't teach like early
↧
Open CV on Java, Mask after findHomography()
I am using opencv in version 2.4.9, using Java JNI. I've downloaded it from [open cv official site][1]. In project there is java\x64\opencv_java249.dll included.
I have problem with `Features2d.drawMatches()` function, it seems that the `mask` parameter is just ignored.
The mask I have is from `Calib3d.findHomography()` method and it looks good. Below I attached my code snippet (just minimal working example, I've deleted all unecceseary stuff). In this case, after `findHomography()` I have masked (size 2530) with only 35 non zero values.
MatOfByte mask = new MatOfByte();
Calib3d.findHomography(firstMatOfPoint2f, secondMatOfPoint2f, Calib3d.RANSAC, 1, mask);
double sum = Stream.of(MatConverter.matToDouble(mask)).mapToDouble(array -> array[0]).sum(); // is 35!
But
Features2d.drawMatches(
first, keyPointsFirst,
second, keyPointsSecond,
matOfDMatch,
output,
Scalar.all(-1), Scalar.all(-1),
mask, // MASK!!!!!!!!!!!!!!!!
Features2d.NOT_DRAW_SINGLE_POINTS
);
draws all (over 2000) matched points.
here you can find ready to use (after image downloaed) code snippet: [code snippet on gist.github.com][2]
I used random images from Wikipedia:
[first picture from wikipedia][3],
[second picture from wikipedia][4]
Here is result I got:
![enter image description here][5]
As you can see, all matched points are drawn, instead just this according to mask. I am doubt if this is a bug in openCv. Maybe I am using incorrect datatypes? I look into the documentation, but provided exampples are in C or Python. I think that I am following instructions from them perfectly.
Regards, Marcin
-------------- updated at 02.12.2014
I simplified my code snippet, a little bit. Now I tried to set mask explicit.
whole code at: https://gist.github.com/sokolek/2ef24411e9c7259d2f5e
MatOfByte mask = new MatOfByte(new byte[matOfDMatch.height()]);
Features2d.drawMatches(
first, keyPointsFirst,
second, keyPointsSecond,
matOfDMatch,
output,
Scalar.all(-1), Scalar.all(-1),
mask, // MASK!!!!!!!!!!!!!!!!
Features2d.NOT_DRAW_SINGLE_POINTS
);
mask is filled by zero, but all of the points are still drawn.
[1]: https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.9/opencv-2.4.9.exe/download
[2]: https://gist.github.com/sokolek/1b53bd1d7cdddb84aabf
[3]: http://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Cabildo_Catedralicio_%281913%29%2C_de_Refugio_Reyes_Rivas.jpg/450px-Cabildo_Catedralicio_%281913%29%2C_de_Refugio_Reyes_Rivas.jpg
[4]: http://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Cabildo_Catedralicio_%281913%29%2C_de_Refugio_Reyes_Rivas_1.jpg/450px-Cabildo_Catedralicio_%281913%29%2C_de_Refugio_Reyes_Rivas_1.jpg
[5]: http://i.stack.imgur.com/BT1vU.jpg
↧
↧
I'll give up and let opencv go
Hi there,
just want to get rid of my frustration. I have to hold back myself not to type f* words.
For weeks...WEEKS I've been trying to install opencv on my Windows machine.
Well at the beginning I was full of enthuiasm. Go for it!
I must admit that I was using cmake the first time. Also c++ is kind of new to me. Anyway, that lesson was fun and easy to go through.
But playing with opencv is somehow "special". Be aware that compilation might fail because....
- some of the modules just come along with syntax or code errors. *Ups, I must have forgot to set the ; at the end of the line*
- Each version has it's own dependencies, variations. Don't try to install opencv 3.4.1 with cuda 9.2. for instance. You will end up in compiling hell. BUT everybody knows that opencv needs cuda 9.1...come on....that experience you have to take. The information about installing opencv is mixed...scrambeled...bottom...up.
- No, no way to get it running.
I don't care anymore. I will have to find a way to get rid of this sh*. Using cuda engine and write my own code for special needs only.
Thank you for wasting my time with false promises.
Keep on going to create good stuff like this.
↧
Datasets to train SVM classification
I tried to train my own SVM to detect people from video.
Here is how I did it: https://stackoverflow.com/questions/51628529/training-your-own-svm-opencv
I think the problem is with my dataset. I used INRIA dataset.
Here is how it looks like: https://drive.google.com/drive/folders/1xijQrOayS_9s93UnYbv8mxxIoqlaJU0Z
There are about 200 positive samples and about 1400 negative.
I want ask you if you know any other datasets which I can download and use with my SVM?
Do you have also any advice on how a well-prepared database should look like?
↧
How do I install OpenCV on Fedora Workstation 28? I need step by step instructions.
I was using OpenCV on Ubuntu 18.04 and switched to Fedora Workstation 28, but now I'm having problems installing and I have not found any step-by-step tutorials on the internet.
↧