Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove yellow border. #140

Open
1mZ1kk4d0 opened this issue Dec 10, 2024 · 1 comment
Open

remove yellow border. #140

1mZ1kk4d0 opened this issue Dec 10, 2024 · 1 comment

Comments

@1mZ1kk4d0
Copy link

1mZ1kk4d0 commented Dec 10, 2024

I looked but couldn't find anything on how to remove this yellow border around the window.

`
use scap::{
capturer::{Capturer, Options, Resolution}, frame::{Frame, FrameType}, get_all_targets, Target
};
use opencv::{core::{get_cuda_enabled_device_count, GpuMat, GpuMatTrait, GpuMatTraitConst, Mat, MatTraitConst, Mat_AUTO_STEP, CV_8UC4}, highgui, imgproc::{self, cvt_color}};

fn main() -> Result<(), Box> {

let targets = get_all_targets();

let new_world_window = targets
.into_iter()
.find(|target| match target {
    Target::Window(window) => window.title == "New World",
    _ => false,
});

let options = Options {
    fps: 30,
    target: new_world_window,
    show_cursor: false,
    show_highlight: false,
    excluded_targets: None,
    output_type: FrameType::BGRAFrame,
    output_resolution: Resolution::_480p,
    crop_area: None,
    ..Default::default()
};

let mut capturer = Capturer::new(options);
capturer.start_capture();

highgui::named_window("Scap Preview", highgui::WINDOW_NORMAL)?;

loop {
    if let Ok(frame) = capturer.get_next_frame() {
        if let Frame::BGRA(bgra_frame) = frame {

            let data = bgra_frame.data.as_slice();
            let width = bgra_frame.width as i32;
            let height = bgra_frame.height as i32;

            
            let bgra_mat = Mat::from_slice(data)?;
            let bgra_mat = bgra_mat.reshape(4, height)?;

            
            let mut bgr_frame = Mat::default();
            imgproc::cvt_color(&bgra_mat, &mut bgr_frame, imgproc::COLOR_BGRA2BGR, 0)?;


            highgui::imshow("Scap Preview", &bgr_frame)?;

            
            if highgui::wait_key(1)? == 'q' as i32 {
                break;
            }
        }
    }
    
}

Ok(())

}
`

@clearlysid
Copy link
Contributor

#141 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants