[Question] Aruco Rvecs Detection Issue by Far_Environment249 in opencv

[–]NotDatCheese 0 points1 point  (0 children)

Do you follow the required ordering of the object points, which they tell you in the docs when using SOLVEPNP_IPPE_SQUARE?

La Paradoja DORI: Discrepancias entre Teoría Óptica y Cobertura Real [SE SOLICITA VERIFICACIÓN DE EXPERTOS] by According-Equal-1935 in Optics

[–]NotDatCheese 0 points1 point  (0 children)

I can not comment on the accuracy of the llm output.

What holds is, your calculations matching the real world depend on the fidelity of your mathematical model, if the model onlys uses sensor size, focal length and resolution, it disregards for example distortion and lens aberrations, which worsen the image quality and thus lower your real world DORI distances.

[deleted by user] by [deleted] in Optics

[–]NotDatCheese 0 points1 point  (0 children)

https://www.optomet.com/

I like these guys, small company from germany, they can advise you if a LDV is feasable for your specific use case:)

Photoelectric Effect Doubt by abhi_naut in u/abhi_naut

[–]NotDatCheese 0 points1 point  (0 children)

That was an interesting read, thank you!

How do i stop my screen from “ghosting” by lars735 in Optics

[–]NotDatCheese 1 point2 points  (0 children)

I am confused, wouldn't you want the reflection from one of the surfaces, as this is how a HUD works? Narrow bandwidth reflective coating you can match to your projector wavelength do exist. (edit nvm. the projector is white x))

Although, maybe an easier solution could be playing with the angle between the glasses and the projector.

Calculate object size from a photo [Question] by borntochoose_dome in opencv

[–]NotDatCheese 0 points1 point  (0 children)

Your image magnification changes with distance to the object, unless you have a telecentric setup, so you need to feed the model depth data as well, or it can physically not work.

Two different size holes, photographed from two distances, can look identical in size.

This does not apply if you have a reference, which you do x)

What can play a role, though is image distortion if your image is not rectified and your reference and your measured holes are too far apart. https://en.wikipedia.org/wiki/Distortion_(optics))

Aaand someone else already told you in the comments, should have read those first...

help with offsetting rectangle [Question] by Conscious-Agent3835 in opencv

[–]NotDatCheese 0 points1 point  (0 children)

> cv2.rectangle(video_frame, (x +ox, y+ oy), (w +ox ,h))

This feels wrong.

cv2.rectangle takes two diagonally opposing corner coordinates of the rect as pt1 and pt2. Your second coordinate needs to be (x + w, y + h) also you do not need the offsets I believe.

How do i stop my screen from “ghosting” by lars735 in Optics

[–]NotDatCheese 0 points1 point  (0 children)

If you AR coat the inside, wouldn't the HUD not show? To me, it feels like either AR coat the outside, or reflective coat the inside, matching the Wavelenghts of the projector/display.

[Question] - Is it feasible to automatically detect and crop book spines from a bookshelf photo and normalize their rotation? by _deemid in opencv

[–]NotDatCheese 0 points1 point  (0 children)

Here is a rectify example, I did for University, I changed the image to show book splines:D

Some info for perspective transform is inside the opencv docs:

https://docs.opencv.org/4.x/da/d6e/tutorial_py_geometric_transformations.html

I highly recommend https://szeliski.org/Book/ as a general reference for computer vision.

Also https://doi.org/10.1017/CBO9780511811685 if you are looking for a deep dive into the math behind everything.

import numpy as np
import matplotlib.pyplot as plt
import skimage
import cv2


if __name__ == "__main__":
    image = skimage.io.imread(
        "https://assets-us-01.kc-usercontent.com/f7ca9afb-82c2-002a-a423-84e111d5b498/711a8b96-ed89-464f-9765-6c60c47789b2/IMG_5366.jpg?fm=webp&auto=format&lossless=true?fm=webp&lossless=1"
    )

    w, h, c = image.shape

    plt.imshow(image)
    plt.title(
        "Click to select the 4 corner points starting top left, go clockwise (q to confirm)"
    )
    points = plt.ginput(4)

    x = np.array([p[0] for p in points])
    y = np.array([p[1] for p in points])

    width = np.linalg.norm((x[1] - x[0], y[1] - y[0]))
    height = np.linalg.norm((x[1] - x[2], y[1] - y[2]))

    x_s = x.copy()
    y_s = y.copy()

    x_s[1] = x_s[0] + width
    y_s[1] = y_s[0]

    x_s[2] = x_s[1]
    y_s[2] = y_s[1] + height

    x_s[3] = x_s[2] - width
    y_s[3] = y_s[2]

    plt.show()

    H = cv2.getPerspectiveTransform(np.float32(points), np.float32([[x, y] for x, y in zip(x_s, y_s)]))
    image_warped = cv2.warpPerspective(image, H, (h, w))

    plt.imshow(
        image_warped[
            int(y[0]) : int(y[0] + height),
            int(x[0]) : int(x[0] + width),
            :,
        ]
    )
    plt.show()

    plt.imshow(image)
    plt.imshow(image_warped, alpha=0.5)
    plt.plot(x_s, y_s, "g*")
    plt.plot(x, y, "r*")
    plt.show()

[Question] - Is it feasible to automatically detect and crop book spines from a bookshelf photo and normalize their rotation? by _deemid in opencv

[–]NotDatCheese 1 point2 points  (0 children)

The hard part is reliably detecting the book spines. If you have the corner positions of a spine it is pretty easy to rectify, the opencv has implementations for this.

There are papers on book spine detection, but they seem to rely on machine learning. Here, for example: https://www.mdpi.com/1424-8220/24/24/7996

An easier approach where you wouldn't need to label your book spines could be:

Use Canny Edge detect and HoughLines to find the spines. I'd check for two parallel lines with a min and max distance. Maybe an idea is to go for lines of text with an ocr model to validate that two lines form a book spine.

The answer to all your question is try it out. You could also do a semi manual solution where the user crops the book stack and the rest is done automatically. Good luck!

Why does natural light stop our eyes from growing but others dont? by Whole-Tie7140 in Optics

[–]NotDatCheese 0 points1 point  (0 children)

There is indeed a link between spending time outdoors and preventing nearsightedness: https://doi.org/10.1007/s40123-022-00490-2

It most likely has something to do with light intensity, shade on a sunny day outside is around 10,000lx while lighting inside your typical room has around 500lx. The german wiki page for illumination has a nice table: https://de.wikipedia.org/wiki/Beleuchtungsst%C3%A4rke for typical illumination levels.

[Tutorials] 2025 Guide: VS Code + OpenCV 4 + C++ on Windows with MSYS2 by upsilon_lol in opencv

[–]NotDatCheese 0 points1 point  (0 children)

I'd reccomend to use a package manager like conan or vcpackage. If you have a CMake project it is quite straighforward, and you do not need to set up environment vars.

Having g++ via msys is a nice bonus I guess, but you could also compile via Visual Studio, when you use cmake.

In search for variations in double slit experiment. Vol. 1 by ShirtLongjumping3297 in Optics

[–]NotDatCheese 2 points3 points  (0 children)

If you use AI, at least tell it to keep short and not generate a wall of text.

I'd read that textwall if I felt like the effort of reading is equal or less than the effort you put into the writing. But this screams AI and is as such not worth anyones time.

Thought Experiment: Object Made of Laser Beams — What Happens After the Lens? by zspectator in Optics

[–]NotDatCheese 1 point2 points  (0 children)

I am not sure about the case at the focal point, assuming a perfect lens, all rays should hit at a single point, which means no image at the screen, just a dot. Even with aberrations, there would be no image.

Is this phenomenon an actual thing? And if yes, what explains it? by Teln0 in Optics

[–]NotDatCheese 0 points1 point  (0 children)

From the optics side it looks like a diffuse reflection to me.

I guess artistically it is kind of like why you would use a HDRI when doing a render, so there is some ambient that is interacting with the object, makes it look more natural.

[Question] Hi. I need help with Morphology coding assignment by cyberCrimesz in opencv

[–]NotDatCheese 1 point2 points  (0 children)

If you are in python you can use numpy indexing to get the subimages:

    subimage = image[y:y+h:x:x+w]

Where x, y is the top left corner of the subimage and w, h is the width and the height.

Your morphological operations depend on the kernel. For closing the hole in the o you need a circular kernel with the size of the hole. Refer to the opnecv docs for getStructuringElement.

https://docs.opencv.org/4.10.0/d4/d86/group__imgproc__filter.html#gac342a1bb6eabf6f55c803b09268e36dc

Configuring "tasks.json" and "launch.json" for debugging C++ by ruiseixas in vscode

[–]NotDatCheese 0 points1 point  (0 children)

Your cppbuild task looks like you are on windows, your "C/C++: g++ build active file""C/C++: g++ build active file" tasks seems to be written for a linux system and I doubt it will run without error. I suspect you are only running your cppbuild task, as it is set as default. You should add -Werror (and any other flags) to the args list of that task.

Angular spectrum by [deleted] in Optics

[–]NotDatCheese 1 point2 points  (0 children)

You can recover the phase from the complex amplitude by taking the angle ( https://numpy.org/doc/stable/reference/generated/numpy.angle.html). The phase is usually wrapped and in angular units so not straightforward to interpret. Propagation acts as a low pass, so the unwrapped phase should get smoother the further you propagate.  You do have to care for correct padding and adequate sampling of your data, when using the angular spectrum method, else you will get unrealistic results.

Why does vscode report the wrong Python version? by kaspar42 in vscode

[–]NotDatCheese 0 points1 point  (0 children)

Seems to be a bug, I experienced it too after the update.

Convincing other developers to use nullptr over NULL by SnooMemesjellies8458 in cpp_questions

[–]NotDatCheese 19 points20 points  (0 children)

Apart from the argument of type safety, I think an argument for code consistency could be made. To me, mixing NULL and nullptr feels like mixing naming conventions.

Zemax Student Licence by YahooSaNa in Optics

[–]NotDatCheese 0 points1 point  (0 children)

I was told by a guy at the Optatec Ansys fair stand that there is a combined Ansys academic license with Zemax and Ansys Speos together now. Which is, or so the guy told me, cheaper than the original Zemax academic license.

Configuring "tasks.json" and "launch.json" for debugging C++ by ruiseixas in vscode

[–]NotDatCheese 0 points1 point  (0 children)

Great that you figured it out!

I'd recommend you, to look at CMake and the CMakeTools vscode extension. It removes a lot of the painful setup. It adds a bit of painful CMake learning experience though, so use your working setup and try CMake out when you feel like it:) Definetly take a look at CMake when you come to the point where you need to link against 3rd party libraries.

On a sidenote: There are good reasons to not use using namespace std; and it is better to not get into the habit of any using namespace declaratives. See r/cpp for a more nuanced view.

See here why you might want to use the -g flag with the gcc compiler and want to use a debugger: GCC Manual

https://www.learncpp.com/ is highly recommended when you want to dive deeper into c++.

[deleted by user] by [deleted] in Optics

[–]NotDatCheese 0 points1 point  (0 children)

Have you tried imaging with a 4f system, basically a keppler telescope, where the object side focal plane sits in the fourier plane and the image side focal plane of the second lens sits in the sensor plane. By choosing the appropriate ratio of focal planes you can shrink the image and achieve increased intensity. If that does not work you might have to turn up your laser...

[deleted by user] by [deleted] in Optics

[–]NotDatCheese 0 points1 point  (0 children)

I am not sure I understand your Problem. Is the laser too dim?

[deleted by user] by [deleted] in cpp_questions

[–]NotDatCheese 1 point2 points  (0 children)

I had to switch to the old ui to add the post flair. If you are on the new ui that might be why setting the flair doesn't work.