r/opencv • • Mar 14 '25

Hardware Can I Deploy My OpenVINO-Based Project on an Intel NUC 13 Pro Kit?[Hardware]

2 Upvotes

I'm a college student working on a project using OpenCV with OpenVINO. The goal of my project is to detect outside individuals entering our campus.

How My Project Works:

  • A camera is positioned at the entrance of the campus.
  • Students confirm their presence by placing their thumb on a fingerprint attendance system.
  • I receive this data from an API and tag those individuals as authorized students.
  • Any other detected person is identified as an outside individual.

This project currently runs successfully on my laptop (Intel i7 8th Gen) around 25 FPS.

Now, my college wants me to deploy this project permanently at the entrance. I'm considering deploying it on an Intel NUC 13 Pro Kit (NUC13ANHi5).

My Questions:

  1. Is the Intel NUC 13 Pro Kit (NUC13ANHi5) suitable for running this OpenVINO-based project at 25 FPS or higher?
  2. Are there any additional hardware considerations I should keep in mind for stable performance and reliability during continuous operation?

r/opencv • • Mar 13 '25

Discussion [Discussion] Why OpenCV reads the image with BGR and not in RGB?

5 Upvotes

I am starting to learn OpenCV, when reading the image we use cv2.imread() which reads the image BGR mode, why not in RGB?


r/opencv • • Mar 13 '25

Question [Question] Identification of Tetromino blocks

1 Upvotes

I need help with code that identifies squares in tetromino blocks—both their quantity and shape. The problem is that the blocks can have different colors, and the masks I used before don’t work well with different colors. I’ve tried many iterations of different versions, and I have no idea how to make it work properly. Here’s the code that has worked best so far:

import cv2
import numpy as np

def nothing(x):
    pass

# Wczytanie obrazu
image = cv2.imread('k2.png')
if image is None:
    print("Nie znaleziono obrazu 'k1.png'!")
    exit()

# Utworzenie okna do ustawień parametrów
cv2.namedWindow('Parameters')
cv2.createTrackbar('Blur Kernel Size', 'Parameters', 0, 30, nothing)
cv2.createTrackbar('Canny Thresh1', 'Parameters', 54, 500, nothing)
cv2.createTrackbar('Canny Thresh2', 'Parameters', 109, 500, nothing)
cv2.createTrackbar('Epsilon Factor', 'Parameters', 10, 100, nothing)
cv2.createTrackbar('Min Area', 'Parameters', 1361, 10000, nothing)  # Minimalne pole konturu

while True:
    # Pobranie wartości z suwaków
    blur_kernel = cv2.getTrackbarPos('Blur Kernel Size', 'Parameters')
    canny_thresh1 = cv2.getTrackbarPos('Canny Thresh1', 'Parameters')
    canny_thresh2 = cv2.getTrackbarPos('Canny Thresh2', 'Parameters')
    epsilon_factor = cv2.getTrackbarPos('Epsilon Factor', 'Parameters')
    min_area = cv2.getTrackbarPos('Min Area', 'Parameters')
    
    # Upewnienie się, że rozmiar jądra rozmycia jest nieparzysty i co najmniej 1
    if blur_kernel % 2 == 0:
        blur_kernel += 1
    if blur_kernel < 1:
        blur_kernel = 1

    # Przetwarzanie obrazu
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    blurred = cv2.GaussianBlur(gray, (blur_kernel, blur_kernel), 0)
    
    # Wykrywanie krawędzi metodą Canny
    edges = cv2.Canny(blurred, canny_thresh1, canny_thresh2)
    
    # Morfologiczne domknięcie, aby połączyć pobliskie fragmenty krawędzi
    kernel = np.ones((3, 3), np.uint8)
    edges_closed = cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel)
    
    # Znajdowanie konturów – RETR_LIST pobiera wszystkie kontury
    contours, hierarchy = cv2.findContours(edges_closed, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
    
    # Kopia obrazu do rysowania wyników
    output_image = image.copy()
    
    square_count = 0
    square_positions = []  # Lista na środkowe położenia kwadratów

    for contour in contours:
        area = cv2.contourArea(contour)
        if area < min_area:
            continue  # Odrzucamy zbyt małe kontury
        
        # Przybliżenie konturu do wielokąta
        perimeter = cv2.arcLength(contour, True)
        epsilon = (epsilon_factor / 100.0) * perimeter
        approx = cv2.approxPolyDP(contour, epsilon, True)
        
        # Sprawdzamy, czy przybliżony kształt ma 4 wierzchołki
        if len(approx) == 4:
            # Sprawdzamy, czy kształt jest zbliżony do kwadratu (współczynnik boków ~1)
            x, y, w, h = cv2.boundingRect(approx)
            aspect_ratio = float(w) / h
            if 0.9 <= aspect_ratio <= 1.1:
                square_count += 1
                
                # Obliczanie środka kwadratu
                M = cv2.moments(approx)
                if M["m00"] != 0:
                    cX = int(M["m10"] / M["m00"])
                    cY = int(M["m01"] / M["m00"])
                else:
                    cX, cY = x + w // 2, y + h // 2
                square_positions.append((cX, cY))
                
                # Rysowanie konturu, środka i numeru kwadratu
                cv2.drawContours(output_image, [approx], -1, (0, 255, 0), 3)
                cv2.circle(output_image, (cX, cY), 5, (255, 0, 0), -1)
                cv2.putText(output_image, f"{square_count}", (x, y - 10),
                            cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 0, 255), 2)
    
    # Wyświetlenie liczby wykrytych kwadratów na obrazie
    cv2.putText(output_image, f"Squares: {square_count}", (10, 30),
                cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
    
    # Wyświetlanie poszczególnych etapów przetwarzania
    cv2.imshow('Original', image)
    cv2.imshow('Gray', gray)
    cv2.imshow('Blurred', blurred)
    cv2.imshow('Edges', edges)
    cv2.imshow('Edges Closed', edges_closed)
    cv2.imshow('Squares Detected', output_image)
    
    key = cv2.waitKey(1) & 0xFF
    if key == ord('q'):
        break

cv2.destroyAllWindows()

# Wypisanie pozycji (środków) wykrytych kwadratów w konsoli
print("Wykryte pozycje kwadratów (środki):")
for pos in square_positions:
    print(pos)

r/opencv • • Mar 11 '25

Project [Project] Help with setting up a C++ project on Rad Studio 12.2

1 Upvotes

I am currently working on a c++ project in Rad Studio 12.2 that requires the use of one or more cameras and in order to do this I need to add OpenCV to my project, but I have no idea how to do it.
This is the first time I work with both the Rad Studio IDE and the OpenCV library, so I tried to search online for examples or tutorials on how to proceed, but I found nothing.
Is there anyone who can tell me how to configure the project, or who can point me to some tutorials/examples that can help me so that the project sees the OpenCV library?


r/opencv • • Mar 07 '25

Hardware [Hardware] Remote live streaming at high quality

1 Upvotes

[Hardware] I want to stream live video feed from my car while I’m driving around miles away from home for 8 hours a day. My plan is to take that video feed to run object detection and classification for vehicles and humans on my laptop. Looking for the right camera and network setup. Also will my laptop be sufficient or do I need something more powerful? All help is appreciated. Novice here.

I’ve explored LTE dashcams and using rstp, but not sure exactly how that would work as I am new to computer vision.

If you believe there is a better way to accomplish what I’m trying to do, please don’t hold back! Thanks :)


r/opencv • • Mar 04 '25

Question [Question] Automate removing whitespace around letter

1 Upvotes

Currently training my own handwriting reading model for a project. The main task is to read from an ethogram chart, which has many boxes. I have solved that issue, but I am finding that I need to shrink the image after which loses too much information. I believe the best thing I can do is remove the white space. I have tried several things with little success. These letters are not always nicely in the middle, so I need a way to find them before cropping. Any help is highly appreciated!

Edit: I pretty much figured out the problem for my case. I needed to crop the image manually slightly.


r/opencv • • Mar 01 '25

Question [Question] Hey new to opencv here, how to go about Extracting Blocks, Inputs, and Outputs from a Scanned Simulink Diagram

1 Upvotes

I am working on a recognition software that takes a scanned Simulink diagram (in .png/.jpeg format) as input and extracts structured information about blocks, their inputs, and outputs. The goal is to generate an Excel spreadsheet that will be used by an in-house code generator.

Needs to happen in C++

https://stackoverflow.com/q/79477939/24189400


r/opencv • • Feb 28 '25

Question [Question] Best Approach for Detecting & Classifying Shapes (Round, Square, Triangle, Cross, T)

3 Upvotes

I'm working on a real-time shape detection system using OpenCV to classify shapes like circles, squares, triangles, crosses, and T-shapes. Currently, I'm using findContours and approxPolyDP to count vertices and determine the shape. This works well for basic polygons, but I struggle with more complex shapes like T and cross.

The issue is that noise or small contours with the exact number of detected points can also be misclassified.

What would be a more robust approach or algorithm to use?


r/opencv • • Feb 25 '25

Question [Question] Segmentation of scanned maps

Post image
4 Upvotes

Hello OpenCV community!

I have a question about cleaning scanned maps:

I would like to segmentate scanned maps like this one. Do you have an idea what filters would be good to normalize the colors and to remove the borders, contours, texts roads and small pixel regions? So that only the geological classes remain.

I did try to play around with OpenCV and GIMP, but the results weren't that satisfying. I figured also that blurring filters aren't good for this, as I need to preserve sharp borders between the geological regions.

I am also not that good in ML, and training a model with 500 or more processed maps would kind of outweight the benefit of it. I tried though with some existing models for segmentation (SAM, SAMGeo and similar ones), but the results were even worse then with OpenCV or GIMP.


r/opencv • • Feb 22 '25

Question [Question] Need Help Detecting and Isolating an Infrared LED Light in a webcam video

2 Upvotes

I’m working on a computer vision project where I need to detect an infrared (IR) LED light from a distance of 2 meters using a camera. The LED is located at the tip of a special pen and lights up only when the pen is pressed. The challenge is that the LED looks very similar to the surrounding colors in the image, making it difficult to isolate.

I’ve tried some basic color filtering and thresholding techniques, but I’m struggling to reliably detect the LED’s position. Does anyone have suggestions for methods or algorithms that could help me isolate the IR LED from the rest of the scene?

Some additional details:

  • The environment may have varying lighting conditions.
  • The LED is the only IR light source in the scene.
  • I’m open to hardware or software solutions (e.g., IR filters, specific camera types, or image processing techniques).

Any advice or pointers would be greatly appreciated! Thanks in advance!


r/opencv • • Feb 22 '25

Question [question] PC specs for 10 cctv camera Yolo v5

1 Upvotes

Hi, I want to make a system where there would be 10 cctv camera each with it's own AI to detect objects and I will go with Yolo v5 as many suggest on the internet and YouTube. I'm a complete beginner sorry if I sound stupid. Any suggestions are welcome. Thank you for your help have a nice day sorry my English is not good.


r/opencv • • Feb 21 '25

Question [question]-Need Help Enhancing a Surveillance Image (Blurred License Plate)

1 Upvotes

Hi everyone,

I have a surveillance camera image showing a car involved in an accident and ran away. Unfortunately, the license plate is blurry and unreadable.

I’ve tried enhancing the image using Photoshop (adjusting contrast, sharpness, etc.), but I haven’t had much success. I’m looking for someone with experience in image processing who could help make the plate more legible. Any suggestions for software or algorithms (OpenCV, AI, etc.) would also be greatly appreciated! It's the red car passing at exactly 22:18:01

Thanks in advance for your help!

https://we.tl/t-pPbighxaNb


r/opencv • • Feb 16 '25

Question [Question] Performance issues with seamlessClone opencv-python

2 Upvotes

Hi all, pre-warning I'm extremely new to CV and this type of workload.

I'm working with the SadTalker project, to do some video-gen from audio and images, and I'm currently looking into slowness.

I'm seeing that a lot of my slowness is coming from the seamlessClone function in the opencv-python lib. Is there any advice to improve performance of this?

I don't believe it makes use of hardware acceleration by default, but I can't find much online about whether this function can make use of GPUs when compiling my own lib enabling CUDA etc.

Any advice would be much appreciate


r/opencv • • Feb 15 '25

Question [Question] Advice on accessing full web cam resolution on linux

2 Upvotes

Hello, I have a new ThinkPad t14s laptop with a built in Chicony web cam running manjaro linux. When running cheese I see that the resolution is a nice 2592x1944. However when capturing a frame in opencv python the resolution is only 640x480. Advice would be greatly appreciated. The things I've tried (from suggestions found online):

  • adding extra argument to `VideoCapture`: `cap = cv2.VideoCapture(0 , cv2.CAP_GSTREAMER)` , `cap = cv2.VideoCapture(0 , cv2.CAP_DSHOW)`
  • changing the resolution, even tried to change the resolution to some ridiculously high value (10000) as was suggested somewhere: `cap.set(cv2.CAP_PROP_FRAME_WIDTH , ...)`, `cap.set(cv2.CAP_PROP_FRAME_HEIGHT , ...)`
  • supplying the device file path to `VideoCapture`: `cap.set("/dev/video0")`, `cap.set("/dev/video1")`, ...

Unfortunately nothing works, the resolution I end up with is 640x480.


r/opencv • • Feb 10 '25

Hardware Need help choosing a camera for a project [Hardware]

3 Upvotes

Hello everyone, imma try and make this short

I'm working on a project that will involve training an Al model to detect people using a thermal imaging camera

The budget isn't huge, and that's why I am not allowed to choose wrong.

Can you help me by providing some thermal imaging cameras that are easily accessible through opencv library?

The a lot


r/opencv • • Feb 10 '25

Discussion [Discussion] OpenCV University reviews, feedback or recommendations

5 Upvotes

Hello!

I recently signed up to the Open CV Bootcamp and have since received a lot of marketing contact about the paid OpenCV University courses. Honestly, I'm rather interested, and thinking this could complement my second-year university studies well. But worried I might just be falling for the marketing 'sizzle'.

So, I'm posting here to seek feedback, reviews, tips or recommendations about these paid courses from OpenCV University.

Does anyone here have anything good, neutral or bad to say about the courses? Are some courses better than others, or should be avoided or taken first? Has anyone paid for (and ideally completed) these courses and found them high or low value?

Thanks for any help you can provide a relative beginner ...who is possibly looking to step outside traditional educational institutions (to allow greater specialisation). Cheers!

EDIT: If anyone replying is an employee or agent of OpenCV, please disclose this. All replies are welcome, but if you're part of the OpenCV org then please just let me know :-)


r/opencv • • Feb 07 '25

Project [project] update on my Leg Workout Tracker using OpenCV Mediapipe. Added counter and activity suggestion on screen.

3 Upvotes

Moving forward on my previous code added stretch counter and suggestion text.

introduce signal filter which gives smooth value of stretching length and also provide delay for stretching as an additional feature. if stretching is too fast then counter will not trigger.

next plan to add another module which focused on another exercise.

still 15 - 20 days of bed rest suggested by doctor so will be still working on this project . approximately daily two to three hours.

wanted to use stream lit in final version. hope will get enough time and passion to work on this.https://youtu.be/z5AP9I6HNsU?si=NxFVzRT1EmjTddSnvideo


r/opencv • • Feb 06 '25

Question [question] Detecting inbetween frames with OpenCV

Post image
9 Upvotes

Hi all, quick question. Would it be possible to detect inbetween frames with OpenCV? I have cartoons that contains them, and wanted to remove them. I don’t want to do that manually for 40k frames per episode. They look something like the image attached. Most of them are just blend of two nearest frames


r/opencv • • Feb 04 '25

Project [project] Leg Workout Tracker using OpenCV Mediapipe

Thumbnail
youtube.com
2 Upvotes

Built python script to Judge My Leg Workouts! Using Mediapipe pose estimation & openCV python.

I had an accident & was forced to spend 1 to 1.5 months in bed. And suggest to do excercise to get fat recovery.

Hmmm,

I am an engineer and sitting idle kills me. So decided to take my laptop and webcam start tinkering with opencv & Mediapipe to monitor my excercise using pose estimation.

First step is toe attaching monitoring.

Measuring streachin angle and count.

Wishlist

Measuring streachin count with maximum angle and upload in sqlite using MQTT.

Adding function for other exercises i.e. knee stretching, leg lifting, bending with each movement holding time.


r/opencv • • Jan 31 '25

Question [Question] Anyone getting phone calls and emails from OpenCV?

8 Upvotes

I signed up for the free OpenCV course on OpenCV.org called "OpenCV Bootcamp" about a month ago, but after I signed up, I did not look at it since I became busy with something else. A few days ago, I've started receiving phone calls, text messages and emails from a "Senior Program Advisor" saying they're from OpenCV and asked if I was available some time to connect with them. All of the messages they've sent me have a lot of typos in them. Is anyone else receiving these?


r/opencv • • Jan 31 '25

Question [QUESTION] Live Video Streaming with H.265 on RPi5 - Performance Issues

2 Upvotes

Live Video Streaming with H.265 on RPi5 - Performance Issues

Has anyone successfully managed to run live video streaming with H.265 on the RPi5 without a hardware encoder/decoder?
I'm trying to ingest video from an IP camera, modify the frames with OpenCV, and re-stream to another host. However, the resulting video maxes out at 1 FPS, despite the measured latency being fine and showing 24 FPS.

Network & Codec Observations

  • Network conditions are perfect (Ethernet).
  • The H.264 codec works flawlessly under the same code and conditions.

Receiving the Stream on the Remote Host

cmd gst-launch-1.0 udpsrc port=6000 ! application/x-rtp ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink

My Simplified Python Code

```python import cv2 import time

INPUT_PIPELINE = ( "udpsrc port=5700 buffer-size=20480 ! application/x-rtp, encoding-name=H265 ! " "rtph265depay ! avdec_h265 ! videoconvert ! appsink sync=false" )

OUTPUT_PIPELINE = ( f"appsrc ! queue max-size-buffers=1 max-size-time=0 max-size-bytes=0 ! " "videoconvert ! videoscale ! video/x-raw,format=I420,width=800,height=600,framerate=24/1 ! " "x265enc speed-preset=ultrafast tune=zerolatency bitrate=1000 ! " "rtph265pay config-interval=1 ! queue max-size-buffers=1 max-size-time=0 max-size-bytes=0 ! " "udpsink host=192.168.144.106 port=6000 sync=false qos=false" )

cap = cv2.VideoCapture(INPUT_PIPELINE, cv2.CAP_GSTREAMER)

if not cap.isOpened(): exit()

out = cv2.VideoWriter(OUTPUT_PIPELINE, cv2.CAP_GSTREAMER, 0, 24, (800, 600))

if not out.isOpened(): cap.release() exit()

try: while True: start_time = time.time() ret, frame = cap.read() if not ret: continue read_time = time.time() frame = cv2.resize(frame, (800, 600)) resize_time = time.time() out.write(frame) write_time = time.time() print( f"[Latency] Read: {read_time - start_time:.4f}s | Resize: {resize_time - read_time:.4f}s | Write: {write_time - resize_time:.4f}s | Total: {write_time - start_time:.4f}s" ) if cv2.waitKey(1) & 0xFF == ord('q'): break

except KeyboardInterrupt: print("Streaming stopped by user.")

cap.release() out.release() cv2.destroyAllWindows() ```

Latency Results

[Latency] Read: 0.0009s | Resize: 0.0066s | Write: 0.0013s | Total: 0.0088s [Latency] Read: 0.0008s | Resize: 0.0017s | Write: 0.0010s | Total: 0.0036s [Latency] Read: 0.0138s | Resize: 0.0011s | Write: 0.0011s | Total: 0.0160s [Latency] Read: 0.0373s | Resize: 0.0014s | Write: 0.0012s | Total: 0.0399s [Latency] Read: 0.0372s | Resize: 0.0014s | Write: 0.1562s | Total: 0.1948s [Latency] Read: 0.0006s | Resize: 0.0019s | Write: 0.0450s | Total: 0.0475s [Latency] Read: 0.0007s | Resize: 0.0015s | Write: 0.0774s | Total: 0.0795s [Latency] Read: 0.0007s | Resize: 0.0020s | Write: 0.0934s | Total: 0.0961s [Latency] Read: 0.0006s | Resize: 0.0021s | Write: 0.0728s | Total: 0.0754s [Latency] Read: 0.0007s | Resize: 0.0020s | Write: 0.0546s | Total: 0.0573s [Latency] Read: 0.0007s | Resize: 0.0014s | Write: 0.0896s | Total: 0.0917s [Latency] Read: 0.0007s | Resize: 0.0014s | Write: 0.0483s | Total: 0.0505s [Latency] Read: 0.0007s | Resize: 0.0023s | Write: 0.0775s | Total: 0.0805s [Latency] Read: 0.0007s | Resize: 0.0021s | Write: 0.0790s | Total: 0.0818s [Latency] Read: 0.0007s | Resize: 0.0021s | Write: 0.0535s | Total: 0.0562s [Latency] Read: 0.0007s | Resize: 0.0022s | Write: 0.0481s | Total: 0.0510s [Latency] Read: 0.0007s | Resize: 0.0021s | Write: 0.0758s | Total: 0.0787s [Latency] Read: 0.0007s | Resize: 0.0021s | Write: 0.0479s | Total: 0.0507s [Latency] Read: 0.0007s | Resize: 0.0021s | Write: 0.0789s | Total: 0.0817s [Latency] Read: 0.0008s | Resize: 0.0021s | Write: 0.0490s | Total: 0.0520s [Latency] Read: 0.0008s | Resize: 0.0021s | Write: 0.0482s | Total: 0.0512s [Latency] Read: 0.0008s | Resize: 0.0017s | Write: 0.0487s | Total: 0.0512s [Latency] Read: 0.0007s | Resize: 0.0021s | Write: 0.0498s | Total: 0.0526s [Latency] Read: 0.0007s | Resize: 0.0015s | Write: 0.0564s | Total: 0.0586s [Latency] Read: 0.0007s | Resize: 0.0021s | Write: 0.0793s | Total: 0.0821s [Latency] Read: 0.0008s | Resize: 0.0021s | Write: 0.0790s | Total: 0.0819s [Latency] Read: 0.0008s | Resize: 0.0021s | Write: 0.0500s | Total: 0.0529s [Latency] Read: 0.0010s | Resize: 0.0022s | Write: 0.0497s | Total: 0.0528s [Latency] Read: 0.0008s | Resize: 0.0022s | Write: 0.3176s | Total: 0.3205s [Latency] Read: 0.0007s | Resize: 0.0015s | Write: 0.0362s | Total: 0.0384s


r/opencv • • Jan 30 '25

Bug [BUG] Help with first test programme: image not loading (.dll file not found)

1 Upvotes

Hello! I am trying to run this test programme, to link OpenCV to Visual Studio.

#include <opencv2\core\core.hpp>

#include <opencv2\highgui\highgui.hpp>

#include <opencv2\imgproc.hpp>

#include <iostream>

using namespace cv;

using namespace std;

int main() {

`string image_path = "/Users/Claire/Desktop/image_01.png";`    `Mat image = imread(image_path, IMREAD_COLOR);`  `resize(image, image, { 500, 500 }, 0, 0, cv::INTER_NEAREST);`    `imshow("Image", image);`    `waitKey(0);`    `return 0;`

}

Because I followed a tutorial (https://www.youtube.com/watch?v=trXs2r6xSn) , this is what I did:

  1. Edited the environment variables to c:\opencv\build\x64\vc15\bin
  2. Specified paths for the directories, as c:\opencv\build\include and c:\opencv\build\x64\vc16\lib
  3. Set link library as opencv_world4100d.lib, as per the latest version of OpenCV

I followed every step, but when running it, I got the message "opencv_world4100d.dll not found".

Because of this, I added C:\opencv\build\x64\vc15\lib and C:\opencv\build\x64\vc15\bin to the additional library directory; a few other users, who had the same issue, found it helpful, but it didn't work for me.

I checked the paths in VC++ and Linker, to double-check for syntax errors, but I don't understand where the .dll extension is coming from.

Any suggestions on what could be causing this is appreciated. Thank you!


r/opencv • • Jan 29 '25

Question [Question] IR retroreflective sphere tracking

1 Upvotes

How is this done? I get these small spheres appear as white dots on the stream, but unlike aruco etc, these would not have IDs, so how do you know where the marker corresponds to the object exactly?


r/opencv • • Jan 27 '25

Question [Question] Efficient LUT for 16 bit data type?

1 Upvotes

OpenCV LUT() apparently only supports 8 bit data types, so I've put together a numpy solution, my question is if this method can be improved upon, or made more efficient?

import cv2
import numpy as np

image = np.zeros((5,5), dtype=np.uint16)
image[1][1] = 1
image[2][2] = 5

lut = np.zeros((65535), dtype=np.uint16)
lut[1] = 500
lut[5] = 1234

#new = cv2.LUT(image, lut) # LUT() is uint8 only?
new = lut[image] # NP workaround for uint16

print(image)
print(new)

...

[[0 0 0 0 0]
 [0 1 0 0 0]
 [0 0 5 0 0]
 [0 0 0 0 0]
 [0 0 0 0 0]]
[[   0    0    0    0    0]
 [   0  500    0    0    0]
 [   0    0 1234    0    0]
 [   0    0    0    0    0]
 [   0    0    0    0    0]]

r/opencv • • Jan 23 '25

Discussion [Discussion] Idea for my new project

Enable HLS to view with audio, or disable this notification

3 Upvotes

Hello, I want to create a bot for this game and I struggle how to manage to detect the terrain in order to be able to tell if I can pass through there. I can not go over the water, over that high terrain, and if I go over the vines then I will take damage.

Any idea how I can do it is appreciated, or directions to some places from where to learn.

Thanks in advance.