# Finding intensity of Vertical bars in a Image

**URL:** <https://forum.opencv.org/t/finding-intensity-of-vertical-bars-in-a-image/1453>\
**Category:** Uncategorized\
**Tags:** imgproc, core\
**Created:** [February 10, 2021, 5:19am UTC](https://forum.opencv.org/t/finding-intensity-of-vertical-bars-in-a-image/1453 "2021-02-10T05:19:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MVSRI](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@MVSRI](https://forum.opencv.org/u/MVSRI)\
**Post date:** [February 10, 2021, 5:19am UTC](https://forum.opencv.org/t/finding-intensity-of-vertical-bars-in-a-image/1453/1 "2021-02-10T05:19:09Z")

</div>

Hey there,  
I’m trying to find **intensity of vertical bars** at the **center of each bar**.  
(_ **`ex.. Drawing a vertical line at the center of each bar and getting rgb values`** _), below is the attached image on which i’m trying to achieve .

 ![demo_1](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/1X/bf540172051fff8365c3fc1b0b619b8a08e53467.jpeg)

As you can see there are 5 Vertical Bars and i need to find intensity(getting RGB values) on those bars at the center of each bar.

I tried using canny edge detection and then findContours but it’s of no use.  
Does anyone have any different approach to solve the problem.

Thank you!

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [February 10, 2021, 8:17am UTC](https://forum.opencv.org/t/finding-intensity-of-vertical-bars-in-a-image/1453/2 "2021-02-10T08:17:31Z")

</div>

Hi,  
You can try to sum over line and column and I hope you will find 5 regions

---

<div class="post-metadata">

**Author:** ![MVSRI](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@MVSRI](https://forum.opencv.org/u/MVSRI)\
**Post date:** [February 10, 2021, 9:27am UTC](https://forum.opencv.org/t/finding-intensity-of-vertical-bars-in-a-image/1453/3 "2021-02-10T09:27:39Z")

</div>

Hey Laurent,  
Can you please elaborate it.

---

<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:** [February 10, 2021, 9:46am UTC](https://forum.opencv.org/t/finding-intensity-of-vertical-bars-in-a-image/1453/4 "2021-02-10T09:46:42Z")

</div>

just read the pixel values? can you please show the code you have so far.

_manually_ define the location (x coordinate) of your vertical lines _along_ which you want to sample your picture.

Canny makes absolutely _no sense_ here. none at all. do not use it. not even “just because”. it’s the wrong tool. it can’t be made to “work”.

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [February 10, 2021, 10:13am UTC](https://forum.opencv.org/t/finding-intensity-of-vertical-bars-in-a-image/1453/5 "2021-02-10T10:13:39Z")

</div>

Something like this

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/1X/9556fb0731cd1669edf182205774805ec6f2c8e3.png)
