添加条形码识别 2023年3月31日18:05:29
parent
62be4db1be
commit
a72f4e12e7
|
|
@ -96,6 +96,11 @@
|
|||
|
||||

|
||||
|
||||
#### 3.13 条形码识别
|
||||
|
||||

|
||||
|
||||
|
||||
### 4. 编解码工具
|
||||
|
||||
> 编解码工具也是对开源组件 Hutool 简单封装展示
|
||||
|
|
|
|||
32
pom.xml
32
pom.xml
|
|
@ -174,12 +174,6 @@
|
|||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-controls -->
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
|
|
@ -324,6 +318,32 @@
|
|||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--javacv 开始-->
|
||||
<dependency>
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>javacpp</artifactId>
|
||||
<version>1.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>javacv</artifactId>
|
||||
<version>1.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>opencv-platform</artifactId>
|
||||
<version>4.1.2-1.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>ffmpeg-platform</artifactId>
|
||||
<version>4.2.1-1.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,101 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import com.zhangmeng.tools.utils.AlertUtils;
|
||||
import com.zhangmeng.tools.utils.ImagePath;
|
||||
import com.zhangmeng.tools.utils.PlateUtil;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-03-31 17:13
|
||||
*/
|
||||
@Slf4j
|
||||
public class BarCodeController {
|
||||
|
||||
public static String tessdata = System.getProperty("user.dir");
|
||||
|
||||
@FXML
|
||||
public Button file_choose_button;
|
||||
|
||||
@FXML
|
||||
public TextArea res_view;
|
||||
|
||||
public static final String language = "eng+chi_sim+chr+num";
|
||||
|
||||
@FXML
|
||||
public Button cover;
|
||||
|
||||
@FXML
|
||||
public TextField file_path;
|
||||
|
||||
@FXML
|
||||
private ImageView image_view;
|
||||
|
||||
public static final SimpleObjectProperty<File> choose_file = new SimpleObjectProperty<>();
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
file_choose_button.setText(null);
|
||||
ImageView iv = new ImageView(new Image(ImagePath.path(ImagePath.ImagePathType.IMAGE_FILE)));
|
||||
iv.setPreserveRatio(true);
|
||||
iv.setFitWidth(18);
|
||||
file_choose_button.setGraphic(iv);
|
||||
|
||||
cover.setText("识别");
|
||||
|
||||
file_choose_button.setOnAction(event -> {
|
||||
choose_file();
|
||||
});
|
||||
|
||||
cover.setOnAction(event -> {
|
||||
if (choose_file.getValue() == null) {
|
||||
AlertUtils.alert_warning("请选择将要识别的条形码再试!");
|
||||
return;
|
||||
}
|
||||
|
||||
File file = choose_file.getValue();
|
||||
Stage alert = AlertUtils.alert_loading(cover.getScene().getWindow());
|
||||
new Thread(() -> {
|
||||
Platform.runLater(() -> {
|
||||
init_tess4j(file);
|
||||
alert.close();
|
||||
});
|
||||
}).start();
|
||||
});
|
||||
}
|
||||
|
||||
public void choose_file() {
|
||||
Stage stage = new Stage();
|
||||
FileChooser dc = new FileChooser();
|
||||
dc.setTitle("文件选择");
|
||||
dc.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("图片类型", "*.jpg", "*.png"));
|
||||
File file = dc.showOpenDialog(stage);
|
||||
if (file != null) {
|
||||
String path = file.getAbsolutePath();
|
||||
file_path.setText(path);
|
||||
log.info("base64---file:{}", path);
|
||||
choose_file.set(file);
|
||||
image_view.setImage(new Image(choose_file.get().getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
public void init_tess4j(File file) {
|
||||
String result = PlateUtil.zxing_bar_code(file.getPath(), 1, 0);
|
||||
res_view.setText(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -492,4 +492,8 @@ public class HomeController implements Serializable {
|
|||
public void word_ocr_menu_item(ActionEvent event) {
|
||||
load_small_tools(11);
|
||||
}
|
||||
|
||||
public void bar_code_menu_item(ActionEvent event) {
|
||||
load_small_tools(12);
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +79,7 @@ public class SmallToolsController {
|
|||
private AnchorPane json_view;
|
||||
private AnchorPane maven_install_jar;
|
||||
private AnchorPane word_ocr;
|
||||
private AnchorPane bar_code;
|
||||
|
||||
@FXML
|
||||
private ListView<ResourcesUtils.SmallTools> listView;
|
||||
|
|
@ -377,11 +378,20 @@ public class SmallToolsController {
|
|||
}
|
||||
word_ocr(flag);
|
||||
}
|
||||
|
||||
if (newValue.getIndex() == 12) {
|
||||
if (bar_code != null) {
|
||||
flag = true;
|
||||
}
|
||||
bar_code(flag);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static Image getImage(ResourcesUtils.SmallTools SmallTools) {
|
||||
return switch (SmallTools) {
|
||||
case Hex_16 -> new Image(ImagePath.path(ImagePath.ImagePathType.Hex_16));
|
||||
|
|
@ -396,6 +406,7 @@ public class SmallToolsController {
|
|||
case JSONView -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
|
||||
case Maven_Install_Jar -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
|
||||
case Word_ocr -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
|
||||
case Bar_Code -> new Image(ImagePath.path(ImagePath.ImagePathType.Qr_CODE));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -649,6 +660,23 @@ public class SmallToolsController {
|
|||
common_method();
|
||||
}
|
||||
|
||||
public void bar_code(boolean flag) {
|
||||
//默认选择第一个
|
||||
listView.getSelectionModel().select(12);
|
||||
|
||||
if (!flag) {
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("bar-code"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
bar_code = root;
|
||||
} else {
|
||||
root = bar_code;
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
|
||||
private void common_method() {
|
||||
splitPane.getItems().remove(1);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ public class WordOcrController {
|
|||
iv.setFitWidth(18);
|
||||
file_choose_button.setGraphic(iv);
|
||||
|
||||
cover.setText("识别");
|
||||
|
||||
file_choose_button.setOnAction(event -> {
|
||||
choose_file();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,656 @@
|
|||
package com.zhangmeng.tools.utils;
|
||||
|
||||
|
||||
import com.google.zxing.*;
|
||||
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfByte;
|
||||
import org.opencv.core.MatOfInt;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferByte;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class PlateUtil {
|
||||
|
||||
public static final int
|
||||
CV_FONT_LIGHT = 25,
|
||||
CV_FONT_NORMAL = 50,
|
||||
CV_FONT_DEMIBOLD = 63,
|
||||
CV_FONT_BOLD = 75,
|
||||
CV_FONT_BLACK = 87,
|
||||
CV_STYLE_NORMAL = 0,
|
||||
CV_STYLE_ITALIC = 1,
|
||||
CV_STYLE_OBLIQUE = 2,
|
||||
CV_LOAD_IMAGE_UNCHANGED = -1,
|
||||
CV_LOAD_IMAGE_GRAYSCALE = 0,
|
||||
CV_LOAD_IMAGE_COLOR = 1,
|
||||
CV_LOAD_IMAGE_ANYDEPTH = 2,
|
||||
CV_LOAD_IMAGE_ANYCOLOR = 4,
|
||||
CV_IMWRITE_JPEG_QUALITY = 1,
|
||||
CV_IMWRITE_PNG_COMPRESSION = 16,
|
||||
CV_IMWRITE_PNG_STRATEGY = 17,
|
||||
CV_IMWRITE_PNG_BILEVEL = 18,
|
||||
CV_IMWRITE_PNG_STRATEGY_DEFAULT = 0,
|
||||
CV_IMWRITE_PNG_STRATEGY_FILTERED = 1,
|
||||
CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
|
||||
CV_IMWRITE_PNG_STRATEGY_RLE = 3,
|
||||
CV_IMWRITE_PNG_STRATEGY_FIXED = 4,
|
||||
CV_IMWRITE_PXM_BINARY = 32,
|
||||
CV_CVTIMG_FLIP = 1,
|
||||
CV_CVTIMG_SWAP_RB = 2,
|
||||
CV_CAP_MSMF = 1400,
|
||||
CV_CAP_ANDROID = 1000,
|
||||
CV_CAP_ANDROID_BACK = CV_CAP_ANDROID + 99,
|
||||
CV_CAP_ANDROID_FRONT = CV_CAP_ANDROID + 98,
|
||||
CV_CAP_XIAPI = 1100,
|
||||
CV_CAP_AVFOUNDATION = 1200,
|
||||
CV_CAP_GIGANETIX = 1300,
|
||||
CV_CAP_PROP_FRAME_WIDTH = 3,
|
||||
CV_CAP_PROP_FRAME_HEIGHT = 4,
|
||||
CV_CAP_PROP_ZOOM = 27,
|
||||
CV_CAP_PROP_FOCUS = 28,
|
||||
CV_CAP_PROP_GUID = 29,
|
||||
CV_CAP_PROP_ISO_SPEED = 30,
|
||||
CV_CAP_PROP_BACKLIGHT = 32,
|
||||
CV_CAP_PROP_PAN = 33,
|
||||
CV_CAP_PROP_TILT = 34,
|
||||
CV_CAP_PROP_ROLL = 35,
|
||||
CV_CAP_PROP_IRIS = 36,
|
||||
CV_CAP_PROP_SETTINGS = 37,
|
||||
CV_CAP_PROP_BUFFERSIZE = 38,
|
||||
CV_CAP_PROP_AUTOGRAB = 1024,
|
||||
CV_CAP_PROP_PREVIEW_FORMAT = 1026,
|
||||
CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301,
|
||||
CV_CAP_PROP_PVAPI_DECIMATIONHORIZONTAL = 302,
|
||||
CV_CAP_PROP_PVAPI_DECIMATIONVERTICAL = 303,
|
||||
CV_CAP_PROP_PVAPI_BINNINGX = 304,
|
||||
CV_CAP_PROP_PVAPI_BINNINGY = 305,
|
||||
CV_CAP_PROP_PVAPI_PIXELFORMAT = 306,
|
||||
CV_CAP_PROP_XI_DOWNSAMPLING = 400,
|
||||
CV_CAP_PROP_XI_DATA_FORMAT = 401,
|
||||
CV_CAP_PROP_XI_OFFSET_X = 402,
|
||||
CV_CAP_PROP_XI_OFFSET_Y = 403,
|
||||
CV_CAP_PROP_XI_TRG_SOURCE = 404,
|
||||
CV_CAP_PROP_XI_TRG_SOFTWARE = 405,
|
||||
CV_CAP_PROP_XI_GPI_SELECTOR = 406,
|
||||
CV_CAP_PROP_XI_GPI_MODE = 407,
|
||||
CV_CAP_PROP_XI_GPI_LEVEL = 408,
|
||||
CV_CAP_PROP_XI_GPO_SELECTOR = 409,
|
||||
CV_CAP_PROP_XI_GPO_MODE = 410,
|
||||
CV_CAP_PROP_XI_LED_SELECTOR = 411,
|
||||
CV_CAP_PROP_XI_LED_MODE = 412,
|
||||
CV_CAP_PROP_XI_MANUAL_WB = 413,
|
||||
CV_CAP_PROP_XI_AUTO_WB = 414,
|
||||
CV_CAP_PROP_XI_AEAG = 415,
|
||||
CV_CAP_PROP_XI_EXP_PRIORITY = 416,
|
||||
CV_CAP_PROP_XI_AE_MAX_LIMIT = 417,
|
||||
CV_CAP_PROP_XI_AG_MAX_LIMIT = 418,
|
||||
CV_CAP_PROP_XI_AEAG_LEVEL = 419,
|
||||
CV_CAP_PROP_XI_TIMEOUT = 420,
|
||||
CV_CAP_PROP_ANDROID_FLASH_MODE = 8001,
|
||||
CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002,
|
||||
CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003,
|
||||
CV_CAP_PROP_ANDROID_ANTIBANDING = 8004,
|
||||
CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005,
|
||||
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006,
|
||||
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007,
|
||||
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008,
|
||||
CV_CAP_PROP_ANDROID_EXPOSE_LOCK = 8009,
|
||||
CV_CAP_PROP_ANDROID_WHITEBALANCE_LOCK = 8010,
|
||||
CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001,
|
||||
CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
|
||||
CV_CAP_PROP_IOS_DEVICE_FLASH = 9003,
|
||||
CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
|
||||
CV_CAP_PROP_IOS_DEVICE_TORCH = 9005,
|
||||
CV_CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,
|
||||
CV_CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,
|
||||
CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,
|
||||
CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,
|
||||
CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
|
||||
CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006,
|
||||
CV_CAP_PROP_INTELPERC_PROFILE_COUNT = 11001,
|
||||
CV_CAP_PROP_INTELPERC_PROFILE_IDX = 11002,
|
||||
CV_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE = 11003,
|
||||
CV_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE = 11004,
|
||||
CV_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD = 11005,
|
||||
CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ = 11006,
|
||||
CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT = 11007,
|
||||
CV_CAP_ANDROID_COLOR_FRAME_BGR = 0,
|
||||
CV_CAP_ANDROID_COLOR_FRAME = CV_CAP_ANDROID_COLOR_FRAME_BGR,
|
||||
CV_CAP_ANDROID_GREY_FRAME = 1,
|
||||
CV_CAP_ANDROID_COLOR_FRAME_RGB = 2,
|
||||
CV_CAP_ANDROID_COLOR_FRAME_BGRA = 3,
|
||||
CV_CAP_ANDROID_COLOR_FRAME_RGBA = 4,
|
||||
CV_CAP_ANDROID_FLASH_MODE_AUTO = 0,
|
||||
CV_CAP_ANDROID_FLASH_MODE_OFF = 0 + 1,
|
||||
CV_CAP_ANDROID_FLASH_MODE_ON = 0 + 2,
|
||||
CV_CAP_ANDROID_FLASH_MODE_RED_EYE = 0 + 3,
|
||||
CV_CAP_ANDROID_FLASH_MODE_TORCH = 0 + 4,
|
||||
CV_CAP_ANDROID_FOCUS_MODE_AUTO = 0,
|
||||
CV_CAP_ANDROID_FOCUS_MODE_CONTINUOUS_PICTURE = 0 + 1,
|
||||
CV_CAP_ANDROID_FOCUS_MODE_CONTINUOUS_VIDEO = 0 + 2,
|
||||
CV_CAP_ANDROID_FOCUS_MODE_EDOF = 0 + 3,
|
||||
CV_CAP_ANDROID_FOCUS_MODE_FIXED = 0 + 4,
|
||||
CV_CAP_ANDROID_FOCUS_MODE_INFINITY = 0 + 5,
|
||||
CV_CAP_ANDROID_FOCUS_MODE_MACRO = 0 + 6,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_AUTO = 0,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_CLOUDY_DAYLIGHT = 0 + 1,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_DAYLIGHT = 0 + 2,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_FLUORESCENT = 0 + 3,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_INCANDESCENT = 0 + 4,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_SHADE = 0 + 5,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_TWILIGHT = 0 + 6,
|
||||
CV_CAP_ANDROID_WHITE_BALANCE_WARM_FLUORESCENT = 0 + 7,
|
||||
CV_CAP_ANDROID_ANTIBANDING_50HZ = 0,
|
||||
CV_CAP_ANDROID_ANTIBANDING_60HZ = 0 + 1,
|
||||
CV_CAP_ANDROID_ANTIBANDING_AUTO = 0 + 2,
|
||||
CV_CAP_ANDROID_ANTIBANDING_OFF = 0 + 3,
|
||||
IMREAD_UNCHANGED = -1,
|
||||
IMREAD_GRAYSCALE = 0,
|
||||
IMREAD_COLOR = 1,
|
||||
IMREAD_ANYDEPTH = 2,
|
||||
IMREAD_ANYCOLOR = 4,
|
||||
IMWRITE_JPEG_QUALITY = 1,
|
||||
IMWRITE_PNG_COMPRESSION = 16,
|
||||
IMWRITE_PNG_STRATEGY = 17,
|
||||
IMWRITE_PNG_BILEVEL = 18,
|
||||
IMWRITE_PNG_STRATEGY_DEFAULT = 0,
|
||||
IMWRITE_PNG_STRATEGY_FILTERED = 1,
|
||||
IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
|
||||
IMWRITE_PNG_STRATEGY_RLE = 3,
|
||||
IMWRITE_PNG_STRATEGY_FIXED = 4,
|
||||
IMWRITE_PXM_BINARY = 32;
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat imdecode(Mat buf, int flags)
|
||||
//
|
||||
|
||||
/**
|
||||
* <p>Reads an image from a buffer in memory.</p>
|
||||
*
|
||||
* <p>The function reads an image from the specified buffer in the memory.
|
||||
* If the buffer is too short or contains invalid data, the empty matrix/image
|
||||
* is returned.</p>
|
||||
*
|
||||
* <p>See "imread" for the list of supported formats and flags description.</p>
|
||||
*
|
||||
* <p>Note: In the case of color images, the decoded images will have the channels
|
||||
* stored in <code>B G R</code> order.</p>
|
||||
*
|
||||
* @param buf Input array or vector of bytes.
|
||||
* @param flags The same flags as in "imread".
|
||||
* @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imdecode">org.opencv.highgui.Highgui.imdecode</a>
|
||||
*/
|
||||
public static Mat imdecode(Mat buf, int flags) {
|
||||
|
||||
Mat retVal = new Mat(imdecode_0(buf.nativeObj, flags));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool imencode(string ext, Mat img, vector_uchar& buf, vector_int params = vector<int>())
|
||||
//
|
||||
|
||||
/**
|
||||
* <p>Encodes an image into a memory buffer.</p>
|
||||
*
|
||||
* <p>The function compresses the image and stores it in the memory buffer that is
|
||||
* resized to fit the result.
|
||||
* See "imwrite" for the list of supported formats and flags description.</p>
|
||||
*
|
||||
* <p>Note: <code>cvEncodeImage</code> returns single-row matrix of type
|
||||
* <code>CV_8UC1</code> that contains encoded image as array of bytes.</p>
|
||||
*
|
||||
* @param ext File extension that defines the output format.
|
||||
* @param img Image to be written.
|
||||
* @param buf Output buffer resized to fit the compressed image.
|
||||
* @param params Format-specific parameters. See "imwrite".
|
||||
* @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imencode">org.opencv.highgui.Highgui.imencode</a>
|
||||
*/
|
||||
public static boolean imencode(String ext, Mat img, MatOfByte buf, MatOfInt params) {
|
||||
Mat buf_mat = buf;
|
||||
Mat params_mat = params;
|
||||
boolean retVal = imencode_0(ext, img.nativeObj, buf_mat.nativeObj, params_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Encodes an image into a memory buffer.</p>
|
||||
*
|
||||
* <p>The function compresses the image and stores it in the memory buffer that is
|
||||
* resized to fit the result.
|
||||
* See "imwrite" for the list of supported formats and flags description.</p>
|
||||
*
|
||||
* <p>Note: <code>cvEncodeImage</code> returns single-row matrix of type
|
||||
* <code>CV_8UC1</code> that contains encoded image as array of bytes.</p>
|
||||
*
|
||||
* @param ext File extension that defines the output format.
|
||||
* @param img Image to be written.
|
||||
* @param buf Output buffer resized to fit the compressed image.
|
||||
* @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imencode">org.opencv.highgui.Highgui.imencode</a>
|
||||
*/
|
||||
public static boolean imencode(String ext, Mat img, MatOfByte buf) {
|
||||
Mat buf_mat = buf;
|
||||
boolean retVal = imencode_1(ext, img.nativeObj, buf_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: Mat imread(string filename, int flags = 1)
|
||||
//
|
||||
|
||||
/**
|
||||
* <p>Loads an image from a file.</p>
|
||||
*
|
||||
* <p>The function <code>imread</code> loads an image from the specified file and
|
||||
* returns it. If the image cannot be read (because of missing file, improper
|
||||
* permissions, unsupported or invalid format), the function returns an empty
|
||||
* matrix (<code>Mat.data==NULL</code>). Currently, the following file formats
|
||||
* are supported:</p>
|
||||
* <ul>
|
||||
* <li> Windows bitmaps - <code>*.bmp, *.dib</code> (always supported)
|
||||
* <li> JPEG files - <code>*.jpeg, *.jpg, *.jpe</code> (see the *Notes*
|
||||
* section)
|
||||
* <li> JPEG 2000 files - <code>*.jp2</code> (see the *Notes* section)
|
||||
* <li> Portable Network Graphics - <code>*.png</code> (see the *Notes*
|
||||
* section)
|
||||
* <li> Portable image format - <code>*.pbm, *.pgm, *.ppm</code> (always
|
||||
* supported)
|
||||
* <li> Sun rasters - <code>*.sr, *.ras</code> (always supported)
|
||||
* <li> TIFF files - <code>*.tiff, *.tif</code> (see the *Notes* section)
|
||||
* </ul>
|
||||
*
|
||||
* <p>Note:</p>
|
||||
* <ul>
|
||||
* <li> The function determines the type of an image by the content, not by
|
||||
* the file extension.
|
||||
* <li> On Microsoft Windows* OS and MacOSX*, the codecs shipped with an
|
||||
* OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default.
|
||||
* So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also
|
||||
* an option to use native MacOSX image readers. But beware that currently these
|
||||
* native image loaders give images with different pixel values because of the
|
||||
* color management embedded into MacOSX.
|
||||
* <li> On Linux*, BSD flavors and other Unix-like open-source operating
|
||||
* systems, OpenCV looks for codecs supplied with an OS image. Install the
|
||||
* relevant packages (do not forget the development files, for example,
|
||||
* "libjpeg-dev", in Debian* and Ubuntu*) to get the codec support or turn on
|
||||
* the <code>OPENCV_BUILD_3RDPARTY_LIBS</code> flag in CMake.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Note: In the case of color images, the decoded images will have the channels
|
||||
* stored in <code>B G R</code> order.</p>
|
||||
*
|
||||
* @param filename Name of file to be loaded.
|
||||
* @param flags Flags specifying the color type of a loaded image:
|
||||
* <ul>
|
||||
* <li> CV_LOAD_IMAGE_ANYDEPTH - If set, return 16-bit/32-bit image when the
|
||||
* input has the corresponding depth, otherwise convert it to 8-bit.
|
||||
* <li> CV_LOAD_IMAGE_COLOR - If set, always convert image to the color one
|
||||
* <li> CV_LOAD_IMAGE_GRAYSCALE - If set, always convert image to the
|
||||
* grayscale one
|
||||
* <li> >0 Return a 3-channel color image.
|
||||
* </ul>
|
||||
* <p>Note: In the current implementation the alpha channel, if any, is stripped
|
||||
* from the output image. Use negative value if you need the alpha channel.</p>
|
||||
* <ul>
|
||||
* <li> =0 Return a grayscale image.
|
||||
* <li> <0 Return the loaded image as is (with alpha channel).
|
||||
* </ul>
|
||||
* @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imread">org.opencv.highgui.Highgui.imread</a>
|
||||
*/
|
||||
public static Mat imread(String filename, int flags) {
|
||||
|
||||
Mat retVal = new Mat(imread_0(filename, flags));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Loads an image from a file.</p>
|
||||
*
|
||||
* <p>The function <code>imread</code> loads an image from the specified file and
|
||||
* returns it. If the image cannot be read (because of missing file, improper
|
||||
* permissions, unsupported or invalid format), the function returns an empty
|
||||
* matrix (<code>Mat.data==NULL</code>). Currently, the following file formats
|
||||
* are supported:</p>
|
||||
* <ul>
|
||||
* <li> Windows bitmaps - <code>*.bmp, *.dib</code> (always supported)
|
||||
* <li> JPEG files - <code>*.jpeg, *.jpg, *.jpe</code> (see the *Notes*
|
||||
* section)
|
||||
* <li> JPEG 2000 files - <code>*.jp2</code> (see the *Notes* section)
|
||||
* <li> Portable Network Graphics - <code>*.png</code> (see the *Notes*
|
||||
* section)
|
||||
* <li> Portable image format - <code>*.pbm, *.pgm, *.ppm</code> (always
|
||||
* supported)
|
||||
* <li> Sun rasters - <code>*.sr, *.ras</code> (always supported)
|
||||
* <li> TIFF files - <code>*.tiff, *.tif</code> (see the *Notes* section)
|
||||
* </ul>
|
||||
*
|
||||
* <p>Note:</p>
|
||||
* <ul>
|
||||
* <li> The function determines the type of an image by the content, not by
|
||||
* the file extension.
|
||||
* <li> On Microsoft Windows* OS and MacOSX*, the codecs shipped with an
|
||||
* OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default.
|
||||
* So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also
|
||||
* an option to use native MacOSX image readers. But beware that currently these
|
||||
* native image loaders give images with different pixel values because of the
|
||||
* color management embedded into MacOSX.
|
||||
* <li> On Linux*, BSD flavors and other Unix-like open-source operating
|
||||
* systems, OpenCV looks for codecs supplied with an OS image. Install the
|
||||
* relevant packages (do not forget the development files, for example,
|
||||
* "libjpeg-dev", in Debian* and Ubuntu*) to get the codec support or turn on
|
||||
* the <code>OPENCV_BUILD_3RDPARTY_LIBS</code> flag in CMake.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Note: In the case of color images, the decoded images will have the channels
|
||||
* stored in <code>B G R</code> order.</p>
|
||||
*
|
||||
* @param filename Name of file to be loaded.
|
||||
* @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imread">org.opencv.highgui.Highgui.imread</a>
|
||||
*/
|
||||
public static Mat imread(String filename) {
|
||||
|
||||
Mat retVal = new Mat(imread_1(filename));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// C++: bool imwrite(string filename, Mat img, vector_int params = vector<int>())
|
||||
//
|
||||
|
||||
/**
|
||||
* <p>Saves an image to a specified file.</p>
|
||||
*
|
||||
* <p>The function <code>imwrite</code> saves the image to the specified file. The
|
||||
* image format is chosen based on the <code>filename</code> extension (see
|
||||
* "imread" for the list of extensions). Only 8-bit (or 16-bit unsigned
|
||||
* (<code>CV_16U</code>) in case of PNG, JPEG 2000, and TIFF) single-channel or
|
||||
* 3-channel (with 'BGR' channel order) images can be saved using this function.
|
||||
* If the format, depth or channel order is different, use "Mat.convertTo", and
|
||||
* "cvtColor" to convert it before saving. Or, use the universal "FileStorage"
|
||||
* I/O functions to save the image to XML or YAML format.
|
||||
* It is possible to store PNG images with an alpha channel using this function.
|
||||
* To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha
|
||||
* channel goes last. Fully transparent pixels should have alpha set to 0, fully
|
||||
* opaque pixels should have alpha set to 255/65535. The sample below shows how
|
||||
* to create such a BGRA image and store to PNG file. It also demonstrates how
|
||||
* to set custom compression parameters <code></p>
|
||||
*
|
||||
* <p>// C++ code:</p>
|
||||
*
|
||||
* <p>#include <vector></p>
|
||||
*
|
||||
* <p>#include <stdio.h></p>
|
||||
*
|
||||
* <p>#include <opencv2/opencv.hpp></p>
|
||||
*
|
||||
* <p>using namespace cv;</p>
|
||||
*
|
||||
* <p>using namespace std;</p>
|
||||
*
|
||||
* <p>void createAlphaMat(Mat &mat)</p>
|
||||
*
|
||||
*
|
||||
* <p>CV_Assert(mat.channels() == 4);</p>
|
||||
*
|
||||
* <p>for (int i = 0; i < mat.rows; ++i) {</p>
|
||||
*
|
||||
* <p>for (int j = 0; j < mat.cols; ++j) {</p>
|
||||
*
|
||||
* <p>Vec4b& bgra = mat.at<Vec4b>(i, j);</p>
|
||||
*
|
||||
* <p>bgra[0] = UCHAR_MAX; // Blue</p>
|
||||
*
|
||||
* <p>bgra[1] = saturate_cast<uchar>((float (mat.cols - j)) / ((float)mat.cols) *
|
||||
* UCHAR_MAX); // Green</p>
|
||||
*
|
||||
* <p>bgra[2] = saturate_cast<uchar>((float (mat.rows - i)) / ((float)mat.rows) *
|
||||
* UCHAR_MAX); // Red</p>
|
||||
*
|
||||
* <p>bgra[3] = saturate_cast<uchar>(0.5 * (bgra[1] + bgra[2])); // Alpha</p>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* <p>int main(int argv, char argc)</p>
|
||||
*
|
||||
*
|
||||
* <p>// Create mat with alpha channel</p>
|
||||
*
|
||||
* <p>Mat mat(480, 640, CV_8UC4);</p>
|
||||
*
|
||||
* <p>createAlphaMat(mat);</p>
|
||||
*
|
||||
* <p>vector<int> compression_params;</p>
|
||||
*
|
||||
* <p>compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION);</p>
|
||||
*
|
||||
* <p>compression_params.push_back(9);</p>
|
||||
*
|
||||
* <p>try {</p>
|
||||
*
|
||||
* <p>imwrite("alpha.png", mat, compression_params);</p>
|
||||
*
|
||||
*
|
||||
* <p>catch (runtime_error& ex) {</p>
|
||||
*
|
||||
* <p>fprintf(stderr, "Exception converting image to PNG format: %sn", ex.what());</p>
|
||||
*
|
||||
* <p>return 1;</p>
|
||||
*
|
||||
*
|
||||
* <p>fprintf(stdout, "Saved PNG file with alpha data.n");</p>
|
||||
*
|
||||
* <p>return 0;</p>
|
||||
*
|
||||
* @param filename Name of the file.
|
||||
* @param img a img
|
||||
* @param params Format-specific save parameters encoded as pairs
|
||||
* <code>paramId_1, paramValue_1, paramId_2, paramValue_2,...</code>. The
|
||||
* following parameters are currently supported:
|
||||
* <ul>
|
||||
* <li> For JPEG, it can be a quality (<code>CV_IMWRITE_JPEG_QUALITY</code>)
|
||||
* from 0 to 100 (the higher is the better). Default value is 95.
|
||||
* <li> For PNG, it can be the compression level (<code>CV_IMWRITE_PNG_COMPRESSION</code>)
|
||||
* from 0 to 9. A higher value means a smaller size and longer compression time.
|
||||
* Default value is 3.
|
||||
* <li> For PPM, PGM, or PBM, it can be a binary format flag (<code>CV_IMWRITE_PXM_BINARY</code>),
|
||||
* 0 or 1. Default value is 1.
|
||||
* </ul>
|
||||
* @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imwrite">org.opencv.highgui.Highgui.imwrite</a>
|
||||
*/
|
||||
public static boolean imwrite(String filename, Mat img, MatOfInt params) {
|
||||
Mat params_mat = params;
|
||||
boolean retVal = imwrite_0(filename, img.nativeObj, params_mat.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Saves an image to a specified file.</p>
|
||||
*
|
||||
* <p>The function <code>imwrite</code> saves the image to the specified file. The
|
||||
* image format is chosen based on the <code>filename</code> extension (see
|
||||
* "imread" for the list of extensions). Only 8-bit (or 16-bit unsigned
|
||||
* (<code>CV_16U</code>) in case of PNG, JPEG 2000, and TIFF) single-channel or
|
||||
* 3-channel (with 'BGR' channel order) images can be saved using this function.
|
||||
* If the format, depth or channel order is different, use "Mat.convertTo", and
|
||||
* "cvtColor" to convert it before saving. Or, use the universal "FileStorage"
|
||||
* I/O functions to save the image to XML or YAML format.
|
||||
* It is possible to store PNG images with an alpha channel using this function.
|
||||
* To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha
|
||||
* channel goes last. Fully transparent pixels should have alpha set to 0, fully
|
||||
* opaque pixels should have alpha set to 255/65535. The sample below shows how
|
||||
* to create such a BGRA image and store to PNG file. It also demonstrates how
|
||||
* to set custom compression parameters <code></p>
|
||||
*
|
||||
* <p>// C++ code:</p>
|
||||
*
|
||||
* <p>#include <vector></p>
|
||||
*
|
||||
* <p>#include <stdio.h></p>
|
||||
*
|
||||
* <p>#include <opencv2/opencv.hpp></p>
|
||||
*
|
||||
* <p>using namespace cv;</p>
|
||||
*
|
||||
* <p>using namespace std;</p>
|
||||
*
|
||||
* <p>void createAlphaMat(Mat &mat)</p>
|
||||
*
|
||||
*
|
||||
* <p>CV_Assert(mat.channels() == 4);</p>
|
||||
*
|
||||
* <p>for (int i = 0; i < mat.rows; ++i) {</p>
|
||||
*
|
||||
* <p>for (int j = 0; j < mat.cols; ++j) {</p>
|
||||
*
|
||||
* <p>Vec4b& bgra = mat.at<Vec4b>(i, j);</p>
|
||||
*
|
||||
* <p>bgra[0] = UCHAR_MAX; // Blue</p>
|
||||
*
|
||||
* <p>bgra[1] = saturate_cast<uchar>((float (mat.cols - j)) / ((float)mat.cols) *
|
||||
* UCHAR_MAX); // Green</p>
|
||||
*
|
||||
* <p>bgra[2] = saturate_cast<uchar>((float (mat.rows - i)) / ((float)mat.rows) *
|
||||
* UCHAR_MAX); // Red</p>
|
||||
*
|
||||
* <p>bgra[3] = saturate_cast<uchar>(0.5 * (bgra[1] + bgra[2])); // Alpha</p>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* <p>int main(int argv, char argc)</p>
|
||||
*
|
||||
*
|
||||
* <p>// Create mat with alpha channel</p>
|
||||
*
|
||||
* <p>Mat mat(480, 640, CV_8UC4);</p>
|
||||
*
|
||||
* <p>createAlphaMat(mat);</p>
|
||||
*
|
||||
* <p>vector<int> compression_params;</p>
|
||||
*
|
||||
* <p>compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION);</p>
|
||||
*
|
||||
* <p>compression_params.push_back(9);</p>
|
||||
*
|
||||
* <p>try {</p>
|
||||
*
|
||||
* <p>imwrite("alpha.png", mat, compression_params);</p>
|
||||
*
|
||||
*
|
||||
* <p>catch (runtime_error& ex) {</p>
|
||||
*
|
||||
* <p>fprintf(stderr, "Exception converting image to PNG format: %sn", ex.what());</p>
|
||||
*
|
||||
* <p>return 1;</p>
|
||||
*
|
||||
*
|
||||
* <p>fprintf(stdout, "Saved PNG file with alpha data.n");</p>
|
||||
*
|
||||
* <p>return 0;</p>
|
||||
*
|
||||
* @param filename Name of the file.
|
||||
* @param img a img
|
||||
* @see <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imwrite">org.opencv.highgui.Highgui.imwrite</a>
|
||||
*/
|
||||
public static boolean imwrite(String filename, Mat img) {
|
||||
|
||||
boolean retVal = imwrite_1(filename, img.nativeObj);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
// C++: Mat imdecode(Mat buf, int flags)
|
||||
private static native long imdecode_0(long buf_nativeObj, int flags);
|
||||
|
||||
// C++: bool imencode(string ext, Mat img, vector_uchar& buf, vector_int params = vector<int>())
|
||||
private static native boolean imencode_0(String ext, long img_nativeObj, long buf_mat_nativeObj, long params_mat_nativeObj);
|
||||
|
||||
private static native boolean imencode_1(String ext, long img_nativeObj, long buf_mat_nativeObj);
|
||||
|
||||
// C++: Mat imread(string filename, int flags = 1)
|
||||
private static native long imread_0(String filename, int flags);
|
||||
|
||||
private static native long imread_1(String filename);
|
||||
|
||||
// C++: bool imwrite(string filename, Mat img, vector_int params = vector<int>())
|
||||
private static native boolean imwrite_0(String filename, long img_nativeObj, long params_mat_nativeObj);
|
||||
|
||||
private static native boolean imwrite_1(String filename, long img_nativeObj);
|
||||
|
||||
/**
|
||||
* @param binaryType 二值化类型
|
||||
* @param adaptiveMethod
|
||||
*/
|
||||
public static String zxing_bar_code(String sourcePath,Integer adaptiveMethod, Integer binaryType) {
|
||||
|
||||
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
|
||||
|
||||
// 加载为灰度图显示
|
||||
Mat source = Imgcodecs.imread(sourcePath,Imgcodecs.IMREAD_GRAYSCALE);
|
||||
Mat destination = new Mat(source.rows(), source.cols(), source.type());
|
||||
Imgproc.threshold(source, destination, 190, 255, Imgproc.THRESH_BINARY);
|
||||
String result = parseCode(destination);
|
||||
log.info("result:{}",result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String parseCode(Mat mat) {
|
||||
String resultText = "无法识别!!!";
|
||||
try {
|
||||
MultiFormatReader formatReader = new MultiFormatReader();
|
||||
BufferedImage image = toBufferedImage(mat);
|
||||
LuminanceSource source = new BufferedImageLuminanceSource(image);
|
||||
Binarizer binarizer = new HybridBinarizer(source);
|
||||
BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
|
||||
|
||||
Map<DecodeHintType, String> hints = new HashMap<DecodeHintType, String>();
|
||||
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
|
||||
|
||||
Result result = formatReader.decode(binaryBitmap, hints);
|
||||
StringBuffer sbuffer = new StringBuffer();
|
||||
sbuffer.append("解析结果 = " + result.toString() + "\n");
|
||||
sbuffer.append("格式类型 = " + result.getBarcodeFormat() + "\n");
|
||||
sbuffer.append("文本内容 = " + result.getText() + "\n");
|
||||
resultText = sbuffer.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultText;
|
||||
}
|
||||
|
||||
public static BufferedImage toBufferedImage(Mat m) {
|
||||
int type = BufferedImage.TYPE_BYTE_GRAY;
|
||||
if (m.channels() > 1) {
|
||||
type = BufferedImage.TYPE_3BYTE_BGR;
|
||||
}
|
||||
int bufferSize = m.channels() * m.cols() * m.rows();
|
||||
byte[] b = new byte[bufferSize];
|
||||
m.get(0, 0, b); // get all the pixels
|
||||
BufferedImage image = new BufferedImage(m.cols(), m.rows(), type);
|
||||
final byte[] targetPixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
|
||||
System.arraycopy(b, 0, targetPixels, 0, b.length);
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
|
@ -122,6 +122,7 @@ public class ResourcesUtils {
|
|||
JSONView("json工具",9),
|
||||
Maven_Install_Jar("maven安装jar",10),
|
||||
Word_ocr("文字识别ocr",11),
|
||||
Bar_Code("条形码识别",12),
|
||||
;
|
||||
|
||||
SmallTools(String title, int index) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.BarCodeController">
|
||||
<children>
|
||||
<AnchorPane layoutX="201.0" layoutY="117.0" style="-fx-border-color: #cbcacb; -fx-border-width: 1;" AnchorPane.bottomAnchor="202.0" AnchorPane.leftAnchor="201.0" AnchorPane.topAnchor="117.0">
|
||||
<children>
|
||||
<ImageView fx:id="image_view" fitHeight="330.0" fitWidth="508.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<TextArea fx:id="res_view" layoutX="727.0" layoutY="69.0" prefHeight="534.0" prefWidth="430.0" AnchorPane.bottomAnchor="46.0" AnchorPane.rightAnchor="43.0" AnchorPane.topAnchor="69.0" />
|
||||
<Button fx:id="file_choose_button" layoutX="202.0" layoutY="67.0" mnemonicParsing="false" text="Button" />
|
||||
<Label layoutX="58.0" layoutY="71.0" text="请选择将要识别的图片:" />
|
||||
<TextField fx:id="file_path" layoutX="280.0" layoutY="67.0" prefHeight="25.0" prefWidth="430.0" />
|
||||
<Label layoutX="129.0" layoutY="116.0" text="图片预览:" />
|
||||
<Button fx:id="cover" layoutX="390.0" layoutY="492.0" mnemonicParsing="false" text="Button" AnchorPane.bottomAnchor="134.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
<MenuItem mnemonicParsing="false" text="JsonView" onAction="#JsonView_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="maven-jar-install" onAction="#maven_jar_install_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="word-ocr" onAction="#word_ocr_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="条形码识别r" onAction="#bar_code_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 102 KiB |
Loading…
Reference in New Issue