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

Low text quality #7

Closed
JustinDBruce opened this issue Sep 27, 2021 · 15 comments
Closed

Low text quality #7

JustinDBruce opened this issue Sep 27, 2021 · 15 comments

Comments

@JustinDBruce
Copy link

Is there a way to increase the quality of the screen? I am have trouble reading some of the text. Maybe increasing the resolution? How could I go about doing that?

Thank you

@leng-yue
Copy link
Owner

Please check Document.
When max_width is set to zero, scrcpy will use the full resolution of the android devices.

@JustinDBruce
Copy link
Author

I am setting the max width to something beside 0, I've tried (1, 1920, 2560, and 3840). I also tried changing the bit rate to 16M, 32M, 64M, and 128M. I seems to have no effect though.

@leng-yue
Copy link
Owner

You can check the numpy nd.array, it's size should be equal to the resolution. By the way, can you add a code snippet? So that I can test on my devices.

@JustinDBruce
Copy link
Author

I think I have found it. In core.py:
def init(
self,
device: Optional[Union[AdbDevice, str]] = None,
max_width: int = 2560, <--setting this has no effect on the screen size
bitrate: int = 16000000,
max_fps: int = 0,
flip: bool = False,
block_frame: bool = False,
stay_awake: bool = False,
lock_screen_orientation: int = const.LOCK_SCREEN_ORIENTATION_UNLOCKED,
):
However,
self.flip = flip
self.max_width = int(1200) <--This will change the screen size
self.bitrate = bitrate
self.max_fps = max_fps
self.block_frame = block_frame
self.stay_awake = stay_awake
self.lock_screen_orientation = lock_screen_orientation

@leng-yue
Copy link
Owner

I found that you set max_size to 1200 manually. Do your phone's screen resolution equals 1200*xxx?

@JustinDBruce
Copy link
Author

No, I use a tablet. When I run scrcpy the Initial texture is 2560x1600. Using this I am getting something else though which is fine. I just needed to increase the size because the text was pixelated and its hard to read.

@leng-yue
Copy link
Owner

You should change your width to 2560. Could you upload a screenshot from your tablet and a screenshot from py-scrcpy?

@JustinDBruce
Copy link
Author

TabletScreenShot
scrcpyScreenShot

I am not able to set the width to 2560, it takes up more room then my screen has. The scrcpyScreenShot is from the default settings. Do you see what I mean about the pixilation?

@leng-yue
Copy link
Owner

I believe you can see the text clearly in 2560, is that correct? My suggestion is to add a factor to the window resize part to make the window smaller.

self.resize(*self.client.resolution)

self.resize(self.client.resolution[0]*0.5, self.client.resolution[1]*0.5)  # 2560 to 1280

After modifying this, while it still consumes 2560 video from your tablet, it shows 1280 on your PC's screen.

@JustinDBruce
Copy link
Author

JustinDBruce commented Sep 29, 2021

Yes you are correct. I made the change you suggested, but no difference is seen. Still displaying at 2560. It was showing a float error so I casted to int(see below). That had no effect either.

        resize = int(self.client.resolution[0]*0.5)
        resize1 = int(self.client.resolution[1]*0.5)
        pix = QPixmap(image)
        self.ui.label.setPixmap(pix)
        self.resize(resize, resize1)

Also trying self.resize(1280, 800) has no effect

@leng-yue
Copy link
Owner

Sorry, I should use // 2 (floor divide) instead of * 0.5.

@leng-yue
Copy link
Owner

If it still doesn't work after casting, you can use OpenCV cv2.resize to resize the image, and the resolution should be smaller.

@JustinDBruce
Copy link
Author

So I was able to go back to default setting and change this setting:
main.py
@click.option(
"--max_width",
default=800, <--Changed to zero
show_default=True,
help="Set max width of the window",
)

Now the screen displays at 2560, but still won't resize with

self.resize(self.client.resolution[0]//2, self.client.resolution[1]//2)

Not too sure on how to use click is there a way to remove this option all together?

@leng-yue
Copy link
Owner

My idea is that you can cv2.resize the image to 1/2 before here

image = QImage(

Then, you can use
self.resize(self.client.resolution[0]//2, self.client.resolution[1]//2)
It should fit your screen.
Using self.resize independently doesn't work is probably caused by the QT's design, since QImage is larger than the window, the window must be resized to large enough to contain this QImage. So we need to make the original image smaller.

@JustinDBruce
Copy link
Author

Thank you for everything! Closing the issue.

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