1/4
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Stage 1 – TRANSLATE
What happens the exact moment a camera frame arrives, and what two conversions take place?
The frame triggers the image_callback via the subscription.
Conversion 1: CvBridge translates the raw ROS message into an OpenCV NumPy array.
Conversion 2: The image is converted from standard BGR to HSV to isolate the true color from changing lights and shadows.
Stage 2 – MASK
How does the loop build the binary mask, and what does the final mask look like?
The code creates a blank black canvas and loops three times to catch bright parts, shadowy parts, and mid-tones.
It stacks these layers together using a Bitwise OR (|=) filter so they don't overwrite each other.
The result is a binary mask: a white silhouette of the target on a completely black background.
Stage 3 – CLEAN What two morphological operations are used to clean sensor noise, and what happens right after?
MORPH_OPEN (Opening): Sweeps away tiny white "dust spots" (isolated noise).
MORPH_CLOSE (Closing): Fills in tiny black holes inside the target shape.
Right after: cv2.findContours() runs to draw a clean digital line/trace around the shape.
Stage 4 – CHECK
What are the three strict elimination checkpoints a detected shape must pass before it is accepted?
Size Gate: Is the shape larger than 3,000 pixels? (Proves it is close enough).
Alignment Gate: Is its center ($c_x$) within the middle 30% of the screen? (Proves the robot is facing it dead-on).
Safety Gate (is_wall_in_front): Does the box contain more than 10% beige wall pixels? (Eliminates wall reflections).
📇 CARD 5: Stage 5 – SNAP
Once a shape passes all checks, how is it saved, and how does the node conserve computer power?
Saving: The code uses cv2.imwrite() to grab the original crisp, color frame and write it as a .jpg in the snaps folder.
Power Saving: The self.image_saved flag flips to True.
This triggers an early exit (return) at the very top of the next camera frames, completely freezing further processing so the robot doesn't waste CPU cycles.