- u_async.c: process immediate_queue BEFORE epoll_wait in uasync_poll - stcp_link.c: defensive NULL etcp_conn/etcp_link in stcp_link_close - utun_instance.c: move stcp_server_list_destroy_all to Phase J (before ETCP), add deferred drain in both Phase J and L - stcp.h/c: STCP_HS_ENC_CLIENT 6→38, STCP_HS_ENC_SERVER 7→39, exchange ed25519_pubkey in both handshake directions - etcp_connections.c: copy peer_ed25519 from STCP to ETCP_CONN in etcp_link_enter_ready_tcp; guard link->etcp in tcp_link_close_cb - chat_sync.c: fix lk->conn NULL dereference for TCP links - test_stcp.c: update stcp_server_create/stcp_client_connect callsites - tools/chat_tcp_test: change transport udp→tcp
60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
/*
|
|
* Copyright 2016 Nu-book Inc.
|
|
* Copyright 2016 ZXing authors
|
|
*/
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
#pragma once
|
|
|
|
#include "DetectorResult.h"
|
|
#include "Matrix.h"
|
|
#include "PerspectiveTransform.h"
|
|
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
namespace ZXing {
|
|
|
|
/**
|
|
* Samples an image for a rectangular matrix of bits of the given dimension. The sampling
|
|
* transformation is determined by the coordinates of 4 points, in the original and transformed
|
|
* image space.
|
|
*
|
|
* The following figure is showing the layout a 'pixel'. The point (0,0) is the upper left corner
|
|
* of the first pixel. (1,1) is its lower right corner.
|
|
*
|
|
* 0 1 ... w
|
|
* 0 #----#-- ... --#
|
|
* | | ... |
|
|
* | | ... |
|
|
* 1 #----# ... --#
|
|
* | | ... |
|
|
*
|
|
* | | ... |
|
|
* h #----#-- ... --#
|
|
*
|
|
* @param image image to sample
|
|
* @param width width of {@link BitMatrix} to sample from image
|
|
* @param height height of {@link BitMatrix} to sample from image
|
|
* @param mod2Pix transforming a module (grid) coordinate into an image (pixel) coordinate
|
|
* @return {@link DetectorResult} representing a grid of points sampled from the image within a region
|
|
* defined by the "src" parameters. Result is empty if transformation is invalid (out of bound access).
|
|
*/
|
|
DetectorResult SampleGrid(const BitMatrix& image, int width, int height, const PerspectiveTransform& mod2Pix);
|
|
|
|
class ROI
|
|
{
|
|
public:
|
|
int x0, x1, y0, y1;
|
|
PerspectiveTransform mod2Pix;
|
|
};
|
|
|
|
using ROIs = std::vector<ROI>;
|
|
|
|
DetectorResult SampleGrid(const BitMatrix& image, int width, int height, const ROIs& rois);
|
|
|
|
DetectorResult SampleGrid(const BitMatrix& image, int width, int height, const PerspectiveTransform& mod2Pix,
|
|
Matrix<std::optional<PointF>>&& apP, const std::vector<int>& apMX, const std::vector<int>& apMY);
|
|
|
|
} // ZXing
|