'How to losslessly zoom in on a binary image?

I am creating a random walk simulation with a million particles in python. I want to create a cool video which starts very zoomed in, then zooms out to show all the particles. However, I can't seem to get a high-res zoomed in image. I tried all cv2.resize interpolation arguments listed here and non worked. You can re-create the full-size frame as such:

frame = np.random.choice((0, 255), size=(1080, 1920))

How can I zoom in very closely and still see individual particles as white squares without loosing resolution?

Note 1: I have the frame itself with all the information (i.e. I am not reading the frame from a video or something like that).

Note 2: I am zooming in by cropping the image array around the center and resizing it, as such:

def get_zoomed(frame, h_perc: float, w_perc: float):
    """given a frame and height and width percentage, return a zoomed in frame"""
    h, w = frame.shape
    h_sub = int(h * h_perc / 2)  # height of zoomed in crop
    w_sub = int(w * w_perc / 2)  # width of zoomed in crop
    center_h, center_w = (h // 2, w // 2)
    frame_crop = frame[center_h - h_sub: center_h +
                      h_sub, center_w - w_sub: center_w + w_sub]  # cropped frame
    return cv2.resize(frame_crop, (w, h), cv2.INTER_LINEAR_EXACT)

EDIT: Note 3: Here is a sample image output from INTER_NEAREST enter image description here



Solution 1:[1]

Christoph Rackwitz pointed out that a keyword argument is needed for the interpolation method to go into the interpolation parameter the way I am calling the function.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 elbashmubarmeg