# \#core

**URL:** https://forum.opencv.org/tag/core/238.md

[Latest](https://forum.opencv.org/latest.md) · [Categories](https://forum.opencv.org/categories.md) · [Tags](https://forum.opencv.org/tags.md)

---

## [cv::Point2f to cv::Point conversion and Matrix element access index](https://forum.opencv.org/t/cv-point2f-to-cv-point-conversion-and-matrix-element-access-index/24113)

<div class="topic-metadata">

**Author:** [@Micka](https://forum.opencv.org/u/Micka)\
**Replies:** 3\
**Last updated:** [October 9, 2025, 3:29pm UTC](https://forum.opencv.org/t/cv-point2f-to-cv-point-conversion-and-matrix-element-access-index/24113 "2025-10-09T15:29:27Z")

</div>

We are working with 8 Bit masks and some feature points with subpixel precision, so our input coordinates are of type cv::Point2f and we want to access pixel positions. Since from processing we can’t guarantee that we a…

---

## [Universal Intrinsics broken in 4.11](https://forum.opencv.org/t/universal-intrinsics-broken-in-4-11/20929)

<div class="topic-metadata">

**Author:** [@Artyom\_Beilis](https://forum.opencv.org/u/Artyom_Beilis)\
**Replies:** 0\
**Last updated:** [April 30, 2025, 9:55pm UTC](https://forum.opencv.org/t/universal-intrinsics-broken-in-4-11/20929 "2025-04-30T21:55:10Z")

</div>

There is total break of Universal intrinsics in 4.11. I disovered it by accident just because I wanted to build standalone version of my project and decided lets build latest version. This code: #include \<opencv2/core/…

---

## [Some problems with old OpenCV library and haarcascade](https://forum.opencv.org/t/some-problems-with-old-opencv-library-and-haarcascade/20899)

<div class="topic-metadata">

**Author:** [@RedCat](https://forum.opencv.org/u/RedCat)\
**Replies:** 3\
**Last updated:** [April 27, 2025, 12:47am UTC](https://forum.opencv.org/t/some-problems-with-old-opencv-library-and-haarcascade/20899 "2025-04-27T00:47:55Z")

</div>

Hi to all, I’m trying to run face recognition on an old version of the OpenCV library, but when uploading a file haarcascade\_frontalface\_alt.xml the library returns an error with the cvLoad function: OpenCV Error: Unsp…

---

## [Clarification on CALL\_HAL Usage in pyrDown and Handling of ROIs in OpenCV](https://forum.opencv.org/t/clarification-on-call-hal-usage-in-pyrdown-and-handling-of-rois-in-opencv/19265)

<div class="topic-metadata">

**Author:** [@Shyama7004](https://forum.opencv.org/u/Shyama7004)\
**Replies:** 2\
**Last updated:** [November 14, 2024, 7:31pm UTC](https://forum.opencv.org/t/clarification-on-call-hal-usage-in-pyrdown-and-handling-of-rois-in-opencv/19265 "2024-11-14T19:31:04Z")

</div>

Hello OpenCV community, I am working on understanding and potentially modifying the pyrDown function in OpenCV to ensure consistent behaviour when processing different regions of interest (ROIs). In particular, I’ve obs…

---

## [How to detect if FileNode operator \>\> (stream) failed](https://forum.opencv.org/t/how-to-detect-if-filenode-operator-stream-failed/19222)

<div class="topic-metadata">

**Author:** [@nintendoeats](https://forum.opencv.org/u/nintendoeats)\
**Replies:** 2\
**Last updated:** [November 8, 2024, 5:24pm UTC](https://forum.opencv.org/t/how-to-detect-if-filenode-operator-stream-failed/19222 "2024-11-08T17:24:06Z")

</div>

Hello. I have inherited a codebase which uses cv::FileNode. There is some code that wraps the \>\> operator in a try-catch block, but as far as I am able to tell this operator doesn’t throw an exception; instead it seems t…

---

## [\[opencv.js\] support for findHomography()](https://forum.opencv.org/t/opencv-js-support-for-findhomography/1126)

<div class="topic-metadata">

**Author:** [@Scott\_Suhy](https://forum.opencv.org/u/Scott_Suhy)\
**Replies:** 22\
**Last updated:** [October 22, 2024, 2:56pm UTC](https://forum.opencv.org/t/opencv-js-support-for-findhomography/1126 "2024-10-22T14:56:05Z")

</div>

can anyone point me to a working example of calling findHomography() using opencv.js? I believe it is part of the subset.

---

## [Error in cv2.add function](https://forum.opencv.org/t/error-in-cv2-add-function/18375)

<div class="topic-metadata">

**Author:** [@D4mn](https://forum.opencv.org/u/D4mn)\
**Replies:** 5\
**Last updated:** [August 16, 2024, 1:00pm UTC](https://forum.opencv.org/t/error-in-cv2-add-function/18375 "2024-08-16T13:00:27Z")

</div>

Note an error when adding two matrices with values ​​200 and 100, the documentation mentions that it will top out at 255 and the result is 300, i have the version 4.10.0

---

## [Using the Mat constructor to reshape will cause the address to be cleared and released](https://forum.opencv.org/t/using-the-mat-constructor-to-reshape-will-cause-the-address-to-be-cleared-and-released/18157)

<div class="topic-metadata">

**Author:** [@menghui](https://forum.opencv.org/u/menghui)\
**Replies:** 2\
**Last updated:** [July 4, 2024, 1:20am UTC](https://forum.opencv.org/t/using-the-mat-constructor-to-reshape-will-cause-the-address-to-be-cleared-and-released/18157 "2024-07-04T01:20:42Z")

</div>

In the following code, the value of t1 is correct before running the cv::Mat t2 = t.clone();, but after running cv::Mat t2 = t.clone();, the value of t1 is modified to be the same as t, and the address of t2 becomes the …

---

## [Error: (-215:Assertion failed) i \< dims() in function 'cv::MatSize::operator \[\]'](https://forum.opencv.org/t/error-215-assertion-failed-i-dims-in-function-cv-operator/17212)

<div class="topic-metadata">

**Author:** [@McKua1](https://forum.opencv.org/u/McKua1)\
**Replies:** 6\
**Last updated:** [April 9, 2024, 12:33pm UTC](https://forum.opencv.org/t/error-215-assertion-failed-i-dims-in-function-cv-operator/17212 "2024-04-09T12:33:55Z")

</div>

I get this error and I dont understand very well why. I create my own model with yolov5 and I export it as ONNX symplified. Also I am using opencv 4.5.4 and c++14 in visual studio 2022. Here i leave mi code: #include \<o…

---

## [How to avoid memory fragment when creating cv::Mat?](https://forum.opencv.org/t/how-to-avoid-memory-fragment-when-creating-cv-mat/16775)

<div class="topic-metadata">

**Author:** [@MyAccount](https://forum.opencv.org/u/MyAccount)\
**Replies:** 1\
**Last updated:** [March 12, 2024, 9:21am UTC](https://forum.opencv.org/t/how-to-avoid-memory-fragment-when-creating-cv-mat/16775 "2024-03-12T09:21:10Z")

</div>

Many operation will automatically init cv::Mat on heap like cv::resize : cv::Mat a = cv::imread("aaa.jpg"); cv::Mat b; cv::Mat c; cv::Mat d; cv::resize(a, b, {256, 256}); cv::resize(a, c, {256\*2, 256\*2}); cv::resize(a, …

---

## [Is there a library data type that can handle both UMat and Mat conversions](https://forum.opencv.org/t/is-there-a-library-data-type-that-can-handle-both-umat-and-mat-conversions/16139)

<div class="topic-metadata">

**Author:** [@faning-wang](https://forum.opencv.org/u/faning-wang)\
**Replies:** 0\
**Last updated:** [January 13, 2024, 1:45am UTC](https://forum.opencv.org/t/is-there-a-library-data-type-that-can-handle-both-umat-and-mat-conversions/16139 "2024-01-13T01:45:44Z")

</div>

I found a mathematical calculation library Eigen, which can convert cv::Mat to Eigen::MatrixXd matrix, but can not convert cv::UMat to Eigen::MatrixXd matrix Here’s my code #include \<eigen3/Eigen/Dense\> #include \<openc…

---

## [Why does use local variable in Mat::resize()?](https://forum.opencv.org/t/why-does-use-local-variable-in-mat-resize/15988)

<div class="topic-metadata">

**Author:** [@whiplash](https://forum.opencv.org/u/whiplash)\
**Replies:** 4\
**Last updated:** [January 2, 2024, 12:37am UTC](https://forum.opencv.org/t/why-does-use-local-variable-in-mat-resize/15988 "2024-01-02T00:37:51Z")

</div>

in the function of Mat::resize(), line 1048 & 1049, where dose use local variable ‘part’, is it valid that assign ‘s’ to ‘part’? or ‘part’ here means the ‘Mat’ object itself ?

---

## [Use NVIDIA GeForce RTX 3070 run opencl version of cv::dft error](https://forum.opencv.org/t/use-nvidia-geforce-rtx-3070-run-opencl-version-of-cv-dft-error/15508)

<div class="topic-metadata">

**Author:** [@tenglike](https://forum.opencv.org/u/tenglike)\
**Replies:** 0\
**Last updated:** [November 14, 2023, 11:22am UTC](https://forum.opencv.org/t/use-nvidia-geforce-rtx-3070-run-opencl-version-of-cv-dft-error/15508 "2023-11-14T11:22:20Z")

</div>

I use NVIDIA GeForce RTX 3070 run opencl version of cv::dft, the code as follows. And I got error when image size is big. Mat img0 = imread("LenaGRAY.bmp", 0); resize(img0, img0, Size(8000, 4000)); img0.convertTo(img0, …

---

## [How to initialize cv::UMat by using data pointer?](https://forum.opencv.org/t/how-to-initialize-cv-umat-by-using-data-pointer/14594)

<div class="topic-metadata">

**Author:** [@tenglike](https://forum.opencv.org/u/tenglike)\
**Replies:** 4\
**Last updated:** [November 8, 2023, 6:24am UTC](https://forum.opencv.org/t/how-to-initialize-cv-umat-by-using-data-pointer/14594 "2023-11-08T06:24:57Z")

</div>

I have opencl, I don’t now how to allocate memory on device and initialize cv::UMat with data pointer. I can’t find the function to do this initialization.

---

## [Passing a nullptr to data in the Mat Constructor](https://forum.opencv.org/t/passing-a-nullptr-to-data-in-the-mat-constructor/14417)

<div class="topic-metadata">

**Author:** [@Hercules\_Holmes](https://forum.opencv.org/u/Hercules_Holmes)\
**Replies:** 2\
**Last updated:** [September 12, 2023, 9:46am UTC](https://forum.opencv.org/t/passing-a-nullptr-to-data-in-the-mat-constructor/14417 "2023-09-12T09:46:37Z")

</div>

Hi, I was recently asked by someone if I need to implement an error handling capability in my wrapper class for Mat in cases where a nullptr in being passed instead of the address to a pre-allocated memory location for t…

---

## [Assessment of the difficulty in porting CPU architecture for openCV](https://forum.opencv.org/t/assessment-of-the-difficulty-in-porting-cpu-architecture-for-opencv/14457)

<div class="topic-metadata">

**Author:** [@xuann](https://forum.opencv.org/u/xuann)\
**Replies:** 1\
**Last updated:** [September 6, 2023, 10:57am UTC](https://forum.opencv.org/t/assessment-of-the-difficulty-in-porting-cpu-architecture-for-opencv/14457 "2023-09-06T10:57:55Z")

</div>

Hello everyone! I am working on implementing a tool to assess the complexity of CPU architecture porting. It primarily focuses on RISC-V architecture porting. As part of my dataset, I have collected openCV project. I wou…

---

## [Use universal SIMD intrinsics in my application and set AVX2 or AVX512](https://forum.opencv.org/t/use-universal-simd-intrinsics-in-my-application-and-set-avx2-or-avx512/13182)

<div class="topic-metadata">

**Author:** [@scottj](https://forum.opencv.org/u/scottj)\
**Replies:** 2\
**Last updated:** [June 17, 2023, 5:17pm UTC](https://forum.opencv.org/t/use-universal-simd-intrinsics-in-my-application-and-set-avx2-or-avx512/13182 "2023-06-17T17:17:13Z")

</div>

I am a fan of OpenCV’s universal intrinsics and would like to use them in my application that uses OpenCV. Unfortunately, OpenCV restricts the use of its SIMD types such as cv::v\_float32 to the size of the SIMD registers…

---

## [OpenCV compilation Question](https://forum.opencv.org/t/opencv-compilation-question/13522)

<div class="topic-metadata">

**Author:** [@MonoSpace](https://forum.opencv.org/u/MonoSpace)\
**Replies:** 13\
**Last updated:** [June 15, 2023, 7:29am UTC](https://forum.opencv.org/t/opencv-compilation-question/13522 "2023-06-15T07:29:23Z")

</div>

Hello, I’m new to OpenCV and C++. Currently, I’m learning OpenCV and there’s something about its compilation that confuses me. I came across a trace function, and when I looked at its definition in the source code, it w…

---

## [Slicing operation help](https://forum.opencv.org/t/slicing-operation-help/13355)

<div class="topic-metadata">

**Author:** [@sycc](https://forum.opencv.org/u/sycc)\
**Replies:** 6\
**Last updated:** [June 7, 2023, 1:34pm UTC](https://forum.opencv.org/t/slicing-operation-help/13355 "2023-06-07T13:34:33Z")

</div>

Can someone explain how one would do this sclicing operation in c++ opencv y\[..., 0:2\] = (y\[..., 0:2\] \* 2 - 0.5 + grid) \* stride when y is with a shape(1,3,80,80,85). I know that I can extract it with the range using …

---

## [Bug regarding Matrix return](https://forum.opencv.org/t/bug-regarding-matrix-return/13359)

<div class="topic-metadata">

**Author:** [@Aditya](https://forum.opencv.org/u/Aditya)\
**Replies:** 2\
**Last updated:** [May 31, 2023, 4:15am UTC](https://forum.opencv.org/t/bug-regarding-matrix-return/13359 "2023-05-31T04:15:39Z")

</div>

I found one bug I initialized one matrix inside one function and returned through function then i get that returned matrix. I found that matrix elements gets deleted below is demo code Mat testDouble() { double …

---

## [Why use R2C of DFT will reduce the width of Mat](https://forum.opencv.org/t/why-use-r2c-of-dft-will-reduce-the-width-of-mat/13270)

<div class="topic-metadata">

**Author:** [@Houber](https://forum.opencv.org/u/Houber)\
**Replies:** 6\
**Last updated:** [May 26, 2023, 5:57am UTC](https://forum.opencv.org/t/why-use-r2c-of-dft-will-reduce-the-width-of-mat/13270 "2023-05-26T05:57:11Z")

</div>

for DFT，a real array’s Fourier Transformation is the same length’s complex array, but opencv’s dft R2C reduce the width, why?

---

## [Why DFT\_REAL\_OUTPUT is different from the real part of complex result](https://forum.opencv.org/t/why-dft-real-output-is-different-from-the-real-part-of-complex-result/13266)

<div class="topic-metadata">

**Author:** [@Houber](https://forum.opencv.org/u/Houber)\
**Replies:** 4\
**Last updated:** [May 24, 2023, 7:15am UTC](https://forum.opencv.org/t/why-dft-real-output-is-different-from-the-real-part-of-complex-result/13266 "2023-05-24T07:15:42Z")

</div>

I foward DFT a image and get a complex result, then i want inverse it to my image, when i use C2C, i get the real part of result and it just my image. but when i use C2R, the result is nothing about my image. i can not u…

---

## [Exposing CV\_MAKETYPE(depth, cn) and CV\_8UC(n), CV\_8SC(n) etc. to python binding](https://forum.opencv.org/t/exposing-cv-maketype-depth-cn-and-cv-8uc-n-cv-8sc-n-etc-to-python-binding/13210)

<div class="topic-metadata">

**Author:** [@alllexx88](https://forum.opencv.org/u/alllexx88)\
**Replies:** 2\
**Last updated:** [May 16, 2023, 9:18am UTC](https://forum.opencv.org/t/exposing-cv-maketype-depth-cn-and-cv-8uc-n-cv-8sc-n-etc-to-python-binding/13210 "2023-05-16T09:18:15Z")

</div>

Hello! As of 4.7.0, C++ macros CV\_MAKETYPE(depth, cn) and CV\_8UC(n), CV\_8SC(n) etc., aren’t exposed in opencv-python. Having them as functions in cv2 could make code dealing with arbitrary channel numbers more readable, …

---

## [Problem with pointer arithmetic for a filtering algorithm](https://forum.opencv.org/t/problem-with-pointer-arithmetic-for-a-filtering-algorithm/13113)

<div class="topic-metadata">

**Author:** [@dnn](https://forum.opencv.org/u/dnn)\
**Replies:** 7\
**Last updated:** [May 12, 2023, 11:12am UTC](https://forum.opencv.org/t/problem-with-pointer-arithmetic-for-a-filtering-algorithm/13113 "2023-05-12T11:12:22Z")

</div>

I have this piece of code: Mat expanded\_image = Mat::zeros(image.rows + 2, image.cols + 2, image.type()); copyMakeBorder(image, expanded\_image, 1, 1, 1, 1, BORDER\_REPLICATE); Mat new\_image = Mat::zeros(image.size(), ima…

---

## [After processing the semantic segmentation results of Deeplabv3 using Argmax, the results were incorrect. Please help me take a look](https://forum.opencv.org/t/after-processing-the-semantic-segmentation-results-of-deeplabv3-using-argmax-the-results-were-incorrect-please-help-me-take-a-look/13136)

<div class="topic-metadata">

**Author:** [@ZJD](https://forum.opencv.org/u/ZJD)\
**Replies:** 7\
**Last updated:** [May 11, 2023, 12:34pm UTC](https://forum.opencv.org/t/after-processing-the-semantic-segmentation-results-of-deeplabv3-using-argmax-the-results-were-incorrect-please-help-me-take-a-look/13136 "2023-05-11T12:34:50Z")

</div>

The inference statement used is this： Mat score = net.forward("outputs"); The output format of the model is float \[1x2x512x648\] The input image looks like this： I can parse the correct results using these few codes. …

---

## [Problem with using cv::utils::fs;](https://forum.opencv.org/t/problem-with-using-cv-fs/13063)

<div class="topic-metadata">

**Author:** [@dnn](https://forum.opencv.org/u/dnn)\
**Replies:** 6\
**Last updated:** [May 5, 2023, 11:26am UTC](https://forum.opencv.org/t/problem-with-using-cv-fs/13063 "2023-05-05T11:26:33Z")

</div>

I am trying to use the canonical method of the cv::utils::fs namespace, but I get an error that cv::utils has no member fs. Any clues what might be wrong?

---

## [Make error : fatal error: va/va.h: No such file or directory](https://forum.opencv.org/t/make-error-fatal-error-va-va-h-no-such-file-or-directory/12975)

<div class="topic-metadata">

**Author:** [@August-us](https://forum.opencv.org/u/August-us)\
**Replies:** 0\
**Last updated:** [April 27, 2023, 12:57pm UTC](https://forum.opencv.org/t/make-error-fatal-error-va-va-h-no-such-file-or-directory/12975 "2023-04-27T12:57:28Z")

</div>

When I build opencv 4.7.0 on CentOS Linux release 7.9.2009 (Core)，I use the command that is “cmake -D CMAKE\_BUILD\_TYPE=RELEASE -D CMAKE\_INSTALL\_PREFIX=/usr/local -D OPENCV\_EXTRA\_MODULES\_PATH=…/…/opencv\_contrib/modu…

---

## [Mat CV\_32SC1 matrix addition has wrong results with OpenCV 4.7 on Mac M1 Pro](https://forum.opencv.org/t/mat-cv-32sc1-matrix-addition-has-wrong-results-with-opencv-4-7-on-mac-m1-pro/12824)

<div class="topic-metadata">

**Author:** [@Jioujiujiu](https://forum.opencv.org/u/Jioujiujiu)\
**Replies:** 1\
**Last updated:** [April 16, 2023, 1:46pm UTC](https://forum.opencv.org/t/mat-cv-32sc1-matrix-addition-has-wrong-results-with-opencv-4-7-on-mac-m1-pro/12824 "2023-04-16T13:46:10Z")

</div>

int main(int argc, char\* argv\[\]){ int a\[2\] = {-1, 0}; cv::Mat b(1, 2, CV\_32SC1, a); cout\<\<"b : "\<\<b\<\<endl; cout\<\<"b+b+1: "\<\<b+b+1\<\<endl; cout\<\<"b+b : "\<\<b+b\<\<endl; cout\<\<"b+b-1: "\<\<b+b-1\<\<endl; cout\<\<"b…

---

## [What's the middle dimension for the result of findCountours?](https://forum.opencv.org/t/whats-the-middle-dimension-for-the-result-of-findcountours/12810)

<div class="topic-metadata">

**Author:** [@Stuart\_Reynolds](https://forum.opencv.org/u/Stuart_Reynolds)\
**Replies:** 6\
**Last updated:** [April 15, 2023, 11:40am UTC](https://forum.opencv.org/t/whats-the-middle-dimension-for-the-result-of-findcountours/12810 "2023-04-15T11:40:46Z")

</div>

findCountours returns a list of arrays. What does the middle dimension for the contours represent? contours\[0\].shape -\> (136, 1, 2)

---

## [Values of cv.mean()](https://forum.opencv.org/t/values-of-cv-mean/12782)

<div class="topic-metadata">

**Author:** [@Lamparvid](https://forum.opencv.org/u/Lamparvid)\
**Replies:** 11\
**Last updated:** [April 12, 2023, 5:07pm UTC](https://forum.opencv.org/t/values-of-cv-mean/12782 "2023-04-12T17:07:04Z")

</div>

Hello, I am using opencv.js. I’m wondering what cv.mean() actually measures? Is it light intensity or pixel values or something else? In my application I use it to measure values of LED:s turning on and of and the value…

[Next page](https://forum.opencv.org/tag/core/238.md?match_all_tags=true&page=1&tags%5B%5D=core)
