# Segmentation fault at rectangle() call

**URL:** <https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023>\
**Category:** C++\
**Tags:** programming\
**Created:** [July 26, 2023, 4:54am UTC](https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023 "2023-07-26T04:54:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![charugupta](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@charugupta](https://forum.opencv.org/u/charugupta)\
**Post date:** [July 26, 2023, 4:54am UTC](https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023/1 "2023-07-26T04:54:41Z")

</div>

Hello All,  
I am facing problem in rectangle function and filter2D while using OpenCV4.6 in C++ on Linux system. OpenCV 4.3 version is working absolutely fine. I have checked all .hpp files are also in place.  
Please advice why its happening so

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [July 26, 2023, 5:18am UTC](https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023/2 "2023-07-26T05:18:13Z")

</div>

> [@charugupta](#):
>
> I am facing problem in rectangle function and filter2D while using OpenCV4.6 in C++

which problem, exactly ?  
we are not psychics, please explain, thank you.

---

<div class="post-metadata">

**Author:** ![charugupta](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@charugupta](https://forum.opencv.org/u/charugupta)\
**Post date:** [July 26, 2023, 5:22am UTC](https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023/3 "2023-07-26T05:22:44Z")

</div>

segmentation fault is coming and when the control of program reaches at rectangle function it crashes and similarly for filter2D

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [July 26, 2023, 5:25am UTC](https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023/4 "2023-07-26T05:25:10Z")

</div>

show code / data, for heaven’s sake !

---

<div class="post-metadata">

**Author:** ![charugupta](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@charugupta](https://forum.opencv.org/u/charugupta)\
**Post date:** [July 26, 2023, 5:32am UTC](https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023/5 "2023-07-26T05:32:17Z")

</div>

Point p1(270,415);  
Point p2(470,615);  
if (check==1)  
rectangle(img, p1, p2, Scalar(255,255,255,1));

When it accesses rectangle function from imgproc it crashes

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [July 26, 2023, 5:59am UTC](https://forum.opencv.org/t/segmentation-fault-at-rectangle-call/14023/6 "2023-07-26T05:59:20Z")

</div>

Welcome. [MRE](https://stackoverflow.com/help/minimal-reproducible-example) required. Thank you.
