viuer terminal images

This commit is contained in:
2024-05-14 23:18:18 +02:00
parent 4327fe8c7c
commit 8c3112f9f2
4 changed files with 371 additions and 16 deletions
+10 -1
View File
@@ -3,6 +3,7 @@ use image_similarity::descriptors::{DCT, Descriptor};
use image_similarity::store::DescriptorStore;
use std::env;
use log::{info, debug, error};
use viuer::{Config, print};
struct Cfg {
path: String
@@ -31,6 +32,14 @@ fn main() {
let img = image::open(cfg.path)
.expect("Unable to open file");
println!("Iamge");
let conf = viuer::Config {
width: Some(16),
height: Some(8),
..Default::default()
};
viuer::print(&img, &conf).expect("Image printing failed.");
println!("Iamge");
let store =
DescriptorStore::new()
.with_file("store.messagepack");
@@ -38,5 +47,5 @@ fn main() {
let phash: u64 = desc.describe(&img);
info!("Phash integer:\n{phash}");
info!("Phash binary:\n{phash:064b}");
store.knn(phash, 4);
store.knn(phash, 10);
}