Before messing with weird get_pixel
This commit is contained in:
parent
400f07f3c9
commit
c7ed0174d5
@ -4,7 +4,7 @@ use anyhow;
|
|||||||
use anyhow::Error; //anyhow::Error::msg("My err");
|
use anyhow::Error; //anyhow::Error::msg("My err");
|
||||||
use opencv::prelude::*;
|
use opencv::prelude::*;
|
||||||
use opencv::highgui::{self, WINDOW_FULLSCREEN};
|
use opencv::highgui::{self, WINDOW_FULLSCREEN};
|
||||||
use opencv::core::{Mat, Vector, Size, CV_8UC3,};
|
use opencv::core::{Mat, Vector, VecN, Size, CV_8UC3,};
|
||||||
use opencv::imgcodecs::{imread, imwrite, IMREAD_COLOR};
|
use opencv::imgcodecs::{imread, imwrite, IMREAD_COLOR};
|
||||||
use opencv::videoio::{VideoWriter, VideoCapture, CAP_ANY};
|
use opencv::videoio::{VideoWriter, VideoCapture, CAP_ANY};
|
||||||
|
|
||||||
@ -75,37 +75,30 @@ fn write_bytes(path: &str, data: Vec<u8>) -> anyhow::Result<()> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
// //Returns average value of the pixel given size and location
|
//Returns average value of the pixel given size and location
|
||||||
// fn get_pixel(frame: &mut EmbedSource, x: i32, y: i32) -> Option<()> {
|
fn get_pixel(frame: &mut EmbedSource, x: i32, y: i32) -> Option<()> {
|
||||||
// if frame.size % 2 != 1 {
|
if frame.size % 2 != 1 {
|
||||||
// panic!("Used even size for pixels, please choose something odd");
|
panic!("Used even size for pixels, please choose something odd");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// let half_size = frame.size/2;
|
let half_size = frame.size/2;
|
||||||
|
|
||||||
// let mut r_list: Vec<u8> = Vec::new();
|
let mut r_list: Vec<u8> = Vec::new();
|
||||||
// let mut g_list: Vec<u8> = Vec::new();
|
let mut g_list: Vec<u8> = Vec::new();
|
||||||
// let mut b_list: Vec<u8> = Vec::new();
|
let mut b_list: Vec<u8> = Vec::new();
|
||||||
|
|
||||||
// for i in -half_size..half_size+1 {
|
for i in -half_size..half_size+1 {
|
||||||
// for j in -half_size..half_size+1 {
|
for j in -half_size..half_size+1 {
|
||||||
// let bgr: &VecN<u8, 3> = frame.image.at_2d::<opencv::core::Vec3b>(y+i, x+j).unwrap();
|
let bgr: &VecN<u8, 3> = frame.image.at_2d::<opencv::core::Vec3b>(y+i, x+j).unwrap();
|
||||||
// //could reduce size of integers ?
|
//could reduce size of integers ?
|
||||||
// r_list.push(bgr[2]);
|
r_list.push(bgr[2]);
|
||||||
// g_list.push(bgr[1]);
|
g_list.push(bgr[1]);
|
||||||
// b_list.push(bgr[0]);
|
b_list.push(bgr[0]);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
// return Some(rgb_average);
|
||||||
// let rgb_average: u8 = vec![
|
return None;
|
||||||
// r_list.iter().sum() / r_list.len(),
|
}
|
||||||
// g_list.iter().sum() / g_list.len(),
|
|
||||||
// b_list.iter().sum() / b_list.len(),
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// // return Some(rgb_average);
|
|
||||||
// return None;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Draws the pixels, exists so you can draw bigger blocks
|
//Draws the pixels, exists so you can draw bigger blocks
|
||||||
fn etch_pixel(frame: &mut EmbedSource, rgb: Vec<u8>, x: i32, y: i32) -> anyhow::Result<()> {
|
fn etch_pixel(frame: &mut EmbedSource, rgb: Vec<u8>, x: i32, y: i32) -> anyhow::Result<()> {
|
||||||
@ -183,6 +176,9 @@ fn etch_frame(source: &mut EmbedSource, data: &Data, global_index: &mut usize)
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_frame() {
|
||||||
|
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Instructions:
|
Instructions:
|
||||||
Etched on first frame, always be wrtten in binary despite output mode
|
Etched on first frame, always be wrtten in binary despite output mode
|
||||||
@ -232,6 +228,10 @@ fn etch_instructions(settings: &Settings, data: &Data)
|
|||||||
return Ok(source);
|
return Ok(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_instructions() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
pub fn etch(path: &str, data: Data, settings: Settings) -> anyhow::Result<()> {
|
pub fn etch(path: &str, data: Data, settings: Settings) -> anyhow::Result<()> {
|
||||||
let mut frames = Vec::new();
|
let mut frames = Vec::new();
|
||||||
let mut index: usize = 0;
|
let mut index: usize = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user