Skip to content

Latest commit

 

History

History
272 lines (144 loc) · 12.3 KB

README.md

File metadata and controls

272 lines (144 loc) · 12.3 KB

ChromoFiber Design Tool

ChromoFiber Design Tool (processing version)

ChromoFiber Design Tool (python version)

LED Locator (OpenCV version , users can observe The process of generating results)

Fiber Clibration Tool (OpenCV with PyQt5, add GUI to LED Locator)

LED stripe controller for lighting LED(Arduino version)

LED stripe controller for color changing

Color Gradient Viewer(python version)

Linear Programming solver(python version)

Dev log

[TOC]

image-20220522235355928

image-20220608144900950

image-20220630231339531

Keyboard operation(change image position and rotation) → controlled by sliders

image-20220630231617886

0704findLed.mov

image-20220704134316641

blinking interval: 0.4s

left : original video clip

right : the detection result with opencv

image-20220704134329683

output the position of each led

The method of selecting keyframes:

  1. get fps from opencv and flashing period from arduino code(0.4s), flashingInterval = 0.4 * fps

  2. the opencv program disposes the video clip frame by frame

  3. record the frame number when the first led lights up as startFrame

  4. curFrame -(curLED * flashingInterval)-startFrame < 0.5 and curFrame -(curLED * flashingInterval)-startFrame >- 0.5 :

    select it !

demo video: 0710FiberCalibrationToolv1.mov

image-20220710233133061

Users can select Obverse/ Reverse by clicking the button. The result will show on the corresponding window.

Users can drag the slider to control the threshold.

image-20220710233159355

Press Import Video button→ choose a video from a new dialog

youtube link:https://youtu.be/ei8W3mmJWns

  • deactivation with linear programing: communicate with python and get read color
  • put updated color to canvas
  • control fiber with processing
  • double-faced (arduino, processing, python)

Control fiber with processing

Successfully implement processing and Arduino communication with Serial

image-20220725114147868

adeactivation with linear programing

let processing communicate with python

This is a screenshot of processing terminal.

image-20220725114204810

use scipy in python for linear programming

fiber deactivation result

https://youtu.be/lqntPTtslf0

When users click the “target color” button, the text on the button will turn into “Real color”. Then processing send all target colors of LEDs to python to do linear programming. The python calculates the color after deactivation and sends the data back.

image-20220726213825607

image-20220726220926467

Algorithm for color gradient calculation

image-20220726213847127

Step 1: shoot photos ( cyan under red, green, blue light for x s)

step 2: use OpenCV to extract the data and fit the surfaces.

step3: calculate the color between the LEDs.

Color Gradient Viewer

image-20220726213856738

sers can input the flashing time of a different color for each LED.

Youtube link for demo: https://youtu.be/jWNFN9iuoOI

This is the workflow of the chromo Fiber project. It contains three parts: Chromofiber Calibration Tool, Chromo Fiber Design Tool and a Linear Programming Solver.

image-20220807193711147

Details for design tool and calibration tool

The position of each LED is marked with a red circle.image-20220807193813022

image-20220807193820662

image-20220807193825890

Color Changing

After the user clicks on the ‘Start Color Changing’ button, the LED will change according to the pattern.image-20220807193903430

change button to “Upload Scanned Video”, add position of each LED

image-20220902232402448

  1. change single LEDs to LED stripe by interpolation
  2. group UI component according to the function

image-20220902232456124

image-20220902232641506

I merged the window into one and drew the fiber on the background image to make it more real. I tried to let the

Users only draw in the area of fiber instead of the whole canvas. It really makes the interface more intuitive! I removed all the widgets about the image. Users can also create beautiful patterns with a brush without an image.

image-20220909094639102

  1. run FiberGUI/camera/testLed/testLed.ino to get video of LED stripe. You need to fix the camera.
  2. run camera/videoProess/fiberCalibrationTool.py to input video, save the ledPos.txt(can place it in the same folder of fiber_GUI.pde) and background image.
  3. run Fiber_GUI/fiber_GUI/solver.py to start the linear programming solver
  4. run Serial/testSerial/testSerial/testSerial.ino to set up Arduino and LED stripe for color changing. You need to define the data_pin according to which PIN the LED stripe is connected with ESP32.
#define DATA_PIN    7 //Pin for data on LedStrip
  1. in fiber_GUI, set the Serial.list[x] for Arduino. If you just want to test the design tool, you can set it to a number less than the length of Serial.list(). You can see the name of Serial in the result printed by printArray(Serial.list())

image-20220909094432731

OpenCV to capture the flash of light. I used it to get 233 photos in a video of a cyan fiber being illuminated with blue light. You need to change the parameters before running the code

image-20220913190312350

<粘贴的图形-1.png>

image-20220913190514085

I added a button to select between “Color Picker Mode” and “Color Wheel Mode”, users can choose black, white, cyan, yellow for the brush color.

![截屏2022-09-13 下午7.13.20](README.assets/截屏2022-09-13 下午7.13.20.png)

I put the new deactivation data in to linear programming solver and test the preview result.

inf= 1000000 FULL_DEACTIVATION_TIME = [[3500,2000,3600],[2000,2000,1000],[inf,4500,60]]

The red color can not be simulated well by our fiber. The green and blue colors can be simulated well.

Currently, there is no constrains on the LED shining time. We can add more constrains to the solver to see the results.

image-20220913190115432

image-20230903003021332

  1. Change LED shape from rectangle to hexagon
  2. Add the Image back and the sliders
  3. Initialize the fiber with a given shape rather than load LED positions.
  4. Disable the color picker mode

color changing time display

image-20231126152511189

After testing the rainbow image, it was found that the maximum time for all colors is 327s. Therefore, I set the maximum color-changing time to 350s.

Speed control

add a checkbox and a slider to set the max time

fix bug: multiple-time preview

image-20231126152530640

# Pure Cyan: RGB(182,168, 249) 
# Pure Magenta:RGB(237, 117,140)
# Pure Yellow: RBG(250, 223, 87)
def standardCMY_to_ourCMY(c,m,y,k):
    pureCyan = rgb_to_cmyk(182,168, 249)
    pureMagenta = rgb_to_cmyk(237, 117,140)
    pureYellow = rgb_to_cmyk(250, 223, 87)

    resC = c* (pureCyan[0] + pureMagenta[0] + pureYellow[0])
    resM = m* (pureCyan[1] + pureMagenta[1] + pureYellow[1])
    resY = y* (pureCyan[2] + pureMagenta[2] + pureYellow[2])
    resK = k* (pureCyan[3] + pureMagenta[3] + pureYellow[3])
    return resC, resM, resY, resK

image-20231201194748186

image-20231201194801938