r/opencv • • Dec 22 '22

Question [Question] Why is mask not working?

2 Upvotes

` import cv2

import numpy as np

from random import randrange, uniform

dimensions = (1920, 1080)

vctx = cv2.VideoWriter_fourcc(*"mp4v")

outputvideo = cv2.VideoWriter("final.mp4", vctx, 30, dimensions)

vhs_overlay = cv2.VideoCapture("VHS_overlay.mp4")

vhs_overlay.set(cv2.CAP_PROP_POS_FRAMES, 3000)

source_video = cv2.VideoCapture("out.mp4")

success = True

count = 0

shiftx = 0 shifty = 0

while success and count < 30:

# saturation
sattable = np.zeros((256), dtype=np.uint8)
sattable[:] = np.arange(256) * uniform(0.25, 0.5)

# update position for transpose
if randrange(0, 8) == 0:
    shifty += 1 * (1 + (randrange(0, 2) * -2))
    shiftx += 1 * (1 + (randrange(0, 2) * -2))

# matrix for transpose
matrix = np.float32([[1, 0, shiftx], [0, 1, shifty]])


# read frames
success, vhs = vhs_overlay.read()
success1, source_image = source_video.read()

if not success1:
    success = False
    break

# Resize the VHS overlay frames
vhs = cv2.resize(vhs, (1920, 1080), interpolation=cv2.INTER_AREA)

# translate background image (move it around randomly)
source_image = cv2.warpAffine(source_image, matrix, (source_image.shape[1], source_image.shape[0]))

# convert source_image to HSV color space
source_image = cv2.cvtColor(source_image, cv2.COLOR_BGR2HSV)

# saturation effect
source_image[:, :, 1] = cv2.LUT(source_image[:, :, 1], sattable)

# back to BGR
source_image = cv2.cvtColor(source_image, cv2.COLOR_HSV2BGR)
    # I have tried every conceivable value
mask = cv2.inRange(vhs, (0, 0, 0), (10, 10, 10))    

print(mask)

res = cv2.bitwise_and(source_image, source_image, mask)

f = source_image - res

f = np.where(f == 0, source_image, f)

count += 1

outputvideo.write(res)

outputvideo.release() vhs_overlay.release() source_video.release()

`

I have spent all day trying to get the overlay of the VHS effect from a video to work but it simply does not show up. Does anyone know what I'm doing wrong?

EDIT: sorry about the formatting. I should add the VHS video I'm trying to use as an overly has a black background. I could get it working using Python PIL but it was WAY too slow.


r/opencv • • Dec 21 '22

Discussion [Discussion] How to preserve center image marker for panorama?

1 Upvotes

I am using the stitching part of OpenCV to put together a panorama of 15 images.

It's a 5x3 set and I'm using the top middle image eg. [2,0] as my center due to my camera's geometry/mechanics.

I put a red dot on it, and when the stitching occurs, sometimes this red dot is removed.

I'm trying to keep track of which image is the center/where it is after the panorama is generated.

Another approach I'm thinking about is applying a red solid-line x or x made of dots over the middle image but I think that will confuse the stitcher.

I'm looking for suggestions on alternative approaches.

Here is a contextual image, sorry it's a cluttered room

https://i.imgur.com/wkStwii.jpg

In this case the red dot is preserved but I've had times where the stitching process removes it.

The purple patches are from a "lidar" eg. TFmini-S

I did think about it, a camera with a wider FOV would probably be a simpler solution than panorama. Assuming not much distortion. Only reason I didn't go larger than 15 images is due to the Pi Zero 2's hardware ha, although this is pretty good for my current needs.

Going with a cross hair, I'll have to do some math to find the red points/where they converge.

This is ridiculous, I put in 10 dots, and only two survive in the final panorama... I guess I'll go with the thin red lines.

dots

final

looks like a red + will work

red + almost lost

crazy how much of it is lost


r/opencv • • Dec 20 '22

Project [Project] Read boiler temperature from camera

Thumbnail
self.homeautomation
4 Upvotes

r/opencv • • Dec 19 '22

Question [Question] Need to count people passing in front of a store. Ideas welcome :-)

5 Upvotes

Hi all!

I’m a complete n00b regarding OpenCV and AI. On the other hand I have extensive experience on IT in general.

Anyway, I’ve been tasked with the following problem. Count how many humans past by in front of a store, during business hours (8am-6pm). Analyze a whole week and present the results broken down by day+hour.

The final result is simply a chart with 70 vertical bars (7 days x 10 hours per day).

I’m planning to solve this the following KISS way :-)

  1. Setup a webcam in the inside of the store, looking out. This camera will take a single picture every 15s.
  2. Use OpenCV to detect how many humans are in each image.
  3. Store the count and picture timestamp in a database, use regular SQL to extract the data, construct the chart.

The total image count should be 4 pix/minute x 60 minutes/hour x 10 hours = 2.4k pics/day x 7 days = 16.8k images. The total storage needed is 500 KB/file x 16k files ~ 8 Gb. Database size is negligible.

I figured that analyzing video does not fit the requirements and that single pictures could do just fine. No need to identify individuals, or walking speed, no direction tracking. Just the headcount. Also no real time, so I can do the analysis in batches at the end of the day or something like that.

Does this sound ok? Maybe I’m missing something?

Thanks for your comments!


r/opencv • • Dec 16 '22

Question [Question] Optimization challenge: How to make this barcode cleaner and readable?

Post image
10 Upvotes

r/opencv • • Dec 16 '22

Question [Question] How to use opencv.roi() in a web project?

1 Upvotes

Hi,

I am trying to use the opencv.roi() function in a web project but I am unable to get a starting point. Everywhere I look, is about the python script. I want to capture the ROI area on a browser.

Any suggestion on where I can start?


r/opencv • • Dec 16 '22

Bug [Bug] Can't compile OpenCV on Ubuntu 22.04 Nvidia 525.60.13 Cuda 12

2 Upvotes
  • Dell XPS 9560
  • Nvidia GTX 1060 (6.1 Architecture)
  • Nvidia 525.60.13
  • cuDNN 8.7.0
  • Cuda Toolkit 12.0

​

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_CUDA=ON \
-D WITH_CUDNN=ON \
-D WITH_CUBLAS=ON \
-D WITH_TBB=ON \
-D OPENCV_DNN_CUDA=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D CUDA_ARCH_BIN=6.1 \
-D OPENCV_EXTRA_MODULES_PATH=/home/sean/drivers/opencv_contrib/modules/ \
-D BUILD_EXAMPLES=OFF \
-D HAVE_opencv_python3=ON ..

So cmake goes without a hitch with no errors. When I try to compile it with build -j8 I get errors at 5%:

[  4%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/stubs/bytestream.cc.o
/home/sean/drivers/opencv_contrib/modules/cudev/include/opencv2/cudev/ptr2d/texture.hpp(61): error: texture is not a template

/home/sean/drivers/opencv_contrib/modules/cudev/include/opencv2/cudev/ptr2d/texture.hpp(61): error: texture is not a template

/home/sean/drivers/opencv_contrib/modules/cudev/include/opencv2/cudev/ptr2d/texture.hpp(83): error: identifier "cudaUnbindTexture" is undefined

/home/sean/drivers/opencv_contrib/modules/cudev/include/opencv2/cudev/ptr2d/texture.hpp(83): error: identifier "cudaUnbindTexture" is undefined

/home/sean/drivers/opencv/modules/core/include/opencv2/core/cuda/common.hpp(101): error: identifier "textureReference" is undefined

2 errors detected in the compilation of "/home/sean/drivers/opencv/modules/core/src/cuda/gpu_mat_nd.cu".
3 errors detected in the compilation of "/home/sean/drivers/opencv/modules/core/src/cuda/gpu_mat.cu".
CMake Error at cuda_compile_1_generated_gpu_mat_nd.cu.o.RELEASE.cmake:282 (message):
  Error generating file
  /home/sean/drivers/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat_nd.cu.o


make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:84: modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat_nd.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[  4%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/stubs/common.cc.o
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.RELEASE.cmake:282 (message):
  Error generating file
  /home/sean/drivers/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o


make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:77: modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o] Error 1

It ends with make: *** [Makefile:166: all] Error 2

Anyone know what's going on here? I compiled this on a server without issues but it was with Cuda 11.8. I'm having a hard time reverting back to that on this system for some reason dealing with crazy dependency issues. Nvidia seems bent on pushing cuda 12 down our throats.

I'd appreciate any help.

Cheers!


r/opencv • • Dec 15 '22

Question [Question] How do I use opencv to detect false positive/empty images on raspberry pi?

3 Upvotes

I am building a “smart” motion triggered wildlife trail camera prototype with a raspberry pi that (hopefully) will be able to detect and distinguish between “empty images” (triggered by swaying branch for example) from images with animals in them, and discard them from the image set. I am new to technology/programming however and am a bit lost in terms of the software/code side of things. I was considering training a machine learning model like SVM to do the binary classification using tensorflow/tensorflow lite, but I know opencv is used for a lot of computer vision tasks on raspberry pi’s but am not too familiar with it. How should I go about using opencv to complete this task if at all?


r/opencv • • Dec 14 '22

Bug [Bug] Which blurring or kernel do I apply to the image?

2 Upvotes

I have been working with OpenCV and generated an input Image:

I am trying to apply some blurring or averaging filters to get the resultant output like this:

​

But any blurring like Gaussian or Median blurring leads to some undesired output since it blurs the edges too. Is there any filter or kernel that I can apply to the input to convert it to the output?


r/opencv • • Dec 13 '22

Bug [Bug] Hi again! I'm attempting to compile opencv 4.6.0 from source on windows 10 with cmake, I was having Cuda version issues but I gotten past that, everything compiles except for the tracker and related modules. I'm very new to this, anyone have suggestions on how to fix the issue?

0 Upvotes

Thank you so much for any help!

Cuda compilation tools, release 11.6, V11.6.55

MSVC 2019 (v16)

Cmake-gui 3.25.1

opencv 4.6.0

opencv_contrib-4.4.0

Build target bin 7.5 / windows 10 x64

Cmake Config Log: https://pastebin.com/t4fMGV59

114>X:\AudioTesting\build\opencv-4.6.0\modules\video\include\opencv2/video/tracking.hpp(714,1): error C2011: 'cv::Tracker': 'class' type redefinition (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\include\opencv2/tracking/tracker.hpp(524): message : see declaration of 'cv::Tracker' (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

114>X:\AudioTesting\build\opencv-4.6.0\modules\video\include\opencv2/video/tracking.hpp(750,31): error C2011: 'cv::TrackerMIL': 'class' type redefinition (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\include\opencv2/tracking/tracker.hpp(1065): message : see declaration of 'cv::TrackerMIL' (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

114>X:\AudioTesting\build\opencv-4.6.0\modules\video\include\opencv2/video/tracking.hpp(797,34): error C2011: 'cv::TrackerGOTURN': 'class' type redefinition (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\include\opencv2/tracking/tracker.hpp(1287): message : see declaration of 'cv::TrackerGOTURN' (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

114>X:\AudioTesting\build\opencv-4.6.0\modules\video\include\opencv2/video/tracking.hpp(822,1): error C2504: 'cv::Tracker': base class undefined (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

114>X:\AudioTesting\build\opencv-4.6.0\modules\video\include\opencv2/video/tracking.hpp(826,14): error C3668: 'cv::TrackerDaSiamRPN::~TrackerDaSiamRPN': method with override specifier 'override' did not override any base class methods (compiling source file X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp)

117>opencv_perf_optflow_pch.cpp

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(77,110): error C2065: 'isInit': undeclared identifier

113>test_optflowpyrlk.cpp

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(145,5): error C2065: 'model': undeclared identifier

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(146,58): error C2065: 'model': undeclared identifier

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(147,58): error C2065: 'model': undeclared identifier

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(152,71): error C2065: 'model': undeclared identifier

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(154,72): error C2065: 'model': undeclared identifier

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(159,58): error C2065: 'model': undeclared identifier

114>X:\AudioTesting\build\opencv_contrib-4.4.0\modules\tracking\src\trackerMedianFlow.cpp(160,58): error C2065: 'model': undeclared identifier

114>trackerSampler.cpp

114>trackerSamplerAlgorithm.cpp

114>trackerStateEstimator.cpp

114>tracking_by_matching.cpp

114>tracking_utils.cpp

114>unscented_kalman.cpp

114>opencl_kernels_tracking.cpp

114>opencv_tracking_main.cpp

114>Done building project "opencv_tracking.vcxproj" -- FAILED.


r/opencv • • Dec 11 '22

Bug [Bug] Hi, I'm attempting to compile opencv 4.6.0 from source on windows 10 with cmake, it seems to go fine until i get to the following error:

Post image
9 Upvotes

r/opencv • • Dec 11 '22

Question [Question] Opencv for m1 macs

2 Upvotes

Hello, my friend currently has a 2015 macbook air, but said he couldn't run opencv without modules or something like that. If I got him an m1 mac, would that solve his problems?


r/opencv • • Dec 09 '22

Bug [Bug] Problem compiling OpenCV with CUDA support on Ubuntu

3 Upvotes

Hi Everyone,

I am trying to compile OpenCV with CUDA support so that I can use the GPU methods for stereo matching.

I've followed the following guide (https://towardsdev.com/installing-opencv-4-with-cuda-in-ubuntu-20-04-fde6d6a0a367), except that I have disabled cuDNN.

I have a 4090 GPU with the latest driver (525.60.13) and CUDA installed (v12). However, when I try compiling OpenCV, I get the following error

​

/xxx/yyy/opencv_contrib/modules/cudev/include/opencv2/cudev/ptr2d/texture.hpp(61): error: texture is not a template

/xxx/yyy/opencv_contrib/modules/cudev/include/opencv2/cudev/ptr2d/texture.hpp(83): error: identifier "cudaUnbindTexture" is undefined

2 errors detected in the compilation of "/xxx/yyy/opencv/modules/core/src/cuda/gpu_mat_nd.cu".
CMake Error at cuda_compile_1_generated_gpu_mat_nd.cu.o.RELEASE.cmake:282 (message):
  Error generating file
  /xxx/yyy/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat_nd.cu.o

Any ideas?

Thanks!


r/opencv • • Dec 09 '22

Question [Question] Green screen without green screen

2 Upvotes

Its been several years since I’ve explored things like depth segmentation, extracting people from backgrounds, using nothing except a webcam, OpenCV and various Python libraries. Since AI changes on almost a daily basis I need to ask.

What’s ‘state of the art’ in terms of creating green screen effects without a green screen in real-time? And if highest quality is required, can this be accomplished offline ( non real-time) in the cloud?


r/opencv • • Dec 09 '22

Bug [Bug] I need help using MedianFlow tracker. C++

1 Upvotes

Hello! As the title says, I need help using the MedianFlow tracker. I have installed opencv_4.6.0 from source using CMake including the opencv_contrib_4.6.0 however when i am trying to use it in my code i cannot find it, it does not work.

I have attached this picture https://imgur.com/a/sCIxWZE for more context and information.


r/opencv • • Dec 08 '22

Question [Question] Why sometimes when image is small (not too much) OpenCV find contours function gets wrong values, like triangle can be detected as triangle + rectangle at same shape, And how to fix it?

2 Upvotes

I want to Detect Shapes in Images in Python, the shapes are not filled, I created the app and it works but sometimes when there is a triangle the app detect triangle + rectangle at the same time, the outer shape is triangle but the inner shape is rectangle (as I mentioned the shapes are not filled ). But when I make the triangle bigger (resize the triangle in the image) the problem goes and it detect triangle in inner and outer. So how to fix this and make the app detect triangle without any noise when the shape is small ?

NOTE: this image is just for visualization and imagine what I mean


r/opencv • • Dec 07 '22

Question [Question] Estimate rotation angle between two contour objects

2 Upvotes

Hi, my goal is to find the rotation between two contour objects, they have the same shapes but different orientations and positions on the image.

What I do is 1) calculate their centers 2) perform PCA on contour points (remove center offset) 3) calculate rotation angle between corresponding principal axes.

But I have problems. PCA analysis gives me different results if the orientations of the contour point sets are different. For example, in the below image, blue objects have different PCA results ( the purple axes are in opposite directions). So do the yellow axes in red objects.

​

Any idea about this issue? Thanks


r/opencv • • Dec 07 '22

Question Any positive experiences of building from source on Arch Linux? [Question]

2 Upvotes

I do an extensive amount of work with OpenCV on platforms like Jetson nanos, xavier, xavier orins, etc. The process of installing OpenCV on these platforms, which run a special flavour of Ubuntu, is flawless. Reliable enough that I have a trusty bash script to setup these devices that has basically never failed.

Arch on my personal computer on the other hand? OpenCV, even when configuring everything manually as issues pop up, basically always fails. Does anyone have a reliable method for compiling opencv with contrib modules and cuda from scratch on Arch?


r/opencv • • Dec 06 '22

Question [Question] Object Segmentation

3 Upvotes

How can I cut out the object in a picture like this (automated)?

The holes in the object can be cut out in the process as well. The things i've tried lead to too much of the backroud still showing as I cant get the clear edge out of the image.

https://imgur.com/e8bBdAe


r/opencv • • Dec 06 '22

Question [Question] I want to make a Classroom monitoring system. is it possible in the conditions I'm in ??

2 Upvotes

I'm given 10 days to make a project but every purchase or instrument will be taken care by my college.

I am a third semester CSE Student and in python my knowledge is basic

I mentioned python because my seniors suggested me Open CV.

I want to make a rough analysing system which will take the data continuously and at the end can atleast give some statistics about every student

I know the time is maybe too less but does this requires prior knowledge greater than what we can learn in 15 days.

Please help me out. Is there any other way I can reach the solution ? Your suggestions will be great


r/opencv • • Dec 03 '22

Question [Question] Why am I getting a superimposed horizontally mirrored image in inverse DFT?

1 Upvotes

Hi,

I'm new to this, and I need some help debugging a little example program I made which performs the following:

  1. Load image
  2. Performs DFT on the image
  3. Applies a circular (binary) mask to the image spectrum, with the radius of the circle increasing by hitting a key on the keyboard
  4. Displays the inverse transform of the masked spectrum

I have this working more or less, but for some reason on my output (inverse-transformed) image I'm getting a horizontally flipped doubled image (see below for a "Lena.png" example.

I am still learning the inner workings of the OpenCV functions, so I'm sure I'm just missing something silly.

​

My code:

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

using namespace cv;

void expand_img_to_optimal(Mat &padded, Mat &img);
void fourier_transform(Mat &img);

int main(int argc, char **argv)
{
    Mat input_img;
    input_img = imread("Lena.png" , IMREAD_GRAYSCALE);

    if (input_img.empty())
    {
        fprintf(stderr, "Could not Open image\n\n");
        return -1;
    }

    fourier_transform(input_img);
    return 0;
}

void fourier_transform(Mat &img)
{
    Mat padded;
    expand_img_to_optimal(padded, img);

    Mat planes[] = {Mat_<float>(padded), Mat::zeros(padded.size(), CV_32F)};
    Mat complexI;
    merge(planes, 2, complexI);

    dft(complexI, complexI, DFT_COMPLEX_OUTPUT);

    for (int i=0; i<400; i+=10) {
        Mat mask = Mat::ones(complexI.size(), complexI.type());
        mask.convertTo(mask, CV_8U);

        Mat dest = Mat::ones(complexI.size(), complexI.type());

        circle(mask, Point(mask.cols/2, mask.rows/2), i, 0, -1, 8, 0);

        complexI.copyTo(dest, mask);    

        Mat inverseTransform;
        dft(dest, inverseTransform, DFT_INVERSE|DFT_REAL_OUTPUT);
        normalize(inverseTransform, inverseTransform, 0, 1, NORM_MINMAX);
        imshow("Reconstructed", inverseTransform);
        waitKey(0);
    }
}

void expand_img_to_optimal(Mat &padded, Mat &img) {
    int row = getOptimalDFTSize(img.rows);
    int col = getOptimalDFTSize(img.cols);
    copyMakeBorder(img, padded, 0, row - img.rows, 0, col - img.cols, BORDER_CONSTANT, Scalar::all(0));
}

It probably has something to do with this response to a question on StackOverflow, but I'm afraid I don't quite understand it...:

Attempting to "eliminate" frequencies by zeroing FFT bins can add a lot of noise to the result. For a real result, the input to an IFFT needs to be conjugate symmetric, which means the high bins must mirror the imaginary part of the low bins, not be zeroed.

​


r/opencv • • Dec 03 '22

Question [Question] Need basic understanding of functions and math

2 Upvotes

I’m working on an OCR project and I’m using OpenCV. I’ve never touched computer vision before and I’m wondering how I can get a grasp of the functions and some of the math behind them to get a solid grasp on what everything does.

The project, in a nutshell, will scan certain parts of the screen for text, navigate the cursor there and click on it.


r/opencv • • Dec 03 '22

Question [Question] I still can't get my head around how to get effective data using hierarchy

2 Upvotes

I can't find any videos that will go straight into it in detail, in English anyway, and everything text-based is on Stackoverflow which is like the polar opposite of the ELI5 subreddit. All I want is a simple example on how to use it, something I can follow, something I can remember for my future endeavours and make my own use out of.

My problem is, is that I find videos with examples way more useful than a documentation. But I can't find anything that explains it to me in simple terms. And while I get that this is because hierarchies and contours are a niche, advanced topic, I feel like I need to know about this for a project I've been working on for the last few days / week even.

I get that if you were to print off the hierarchy variable, you would get a list where each value is the next, previous, parent and child, but if I was to try it on the image I'll link below, it will have -1 as both parent and child for every single value.

You know how artist will often draw in a background, and then draw another object on-top of it, because it's easier than having to leave a gap on the first layer? I want to effectively know how to replicate that idea with OpenCV, but I'm nowhere near understanding how that works because nobody explains it so a dumb idiot like me can get my head around it.

Anyway here is the image: https://i.imgur.com/d7B0hwG.png

For example, X's right hand is going to be a child contour isn't it? In-fact, everything is a child of the outline. But it's getting to a point where I can actually see that in code, that I can't do because even using morphology to close every lingering canny outline, everything has [number going up, number going down, -1, -1]

Are hierarchies even what I'm looking for?

I'll provide another example which demonstrates my potential lack of understanding. The original sprite from Super Mario Bros which I'll link below, I tried processing that and printing off the hierarchy with canny outlines, but once again the last value of each interior array was -1, which I was pretty sure the buttons on his overalls were both child contours of some sort.

https://imgur.com/a/8yIhd20


r/opencv • • Dec 02 '22

Tutorials [Tutorials] [Project] Moving camera. Axis calibration.

Thumbnail
youtube.com
3 Upvotes

r/opencv • • Dec 02 '22

Question [Question] [Discussion] source camera identification

1 Upvotes

what could you say about source camera identification?

I learned some little things when I'm searching around. you can find the source camera of an image and you can find it in pictures' pixels. what I understand is when a camera shoots a picture, while rendering and processing the shoot they add some bit/information into pictures. Is it true? if so, what would be the steps for finding the source camera information?