Skip to content

Commit 178e4a4

Browse files
feat: Add TextDetectionParams.advanced_ocr_options (#962)
- [ ] Regenerate this pull request now. Advanced OCR options allow users to customize behavior for a specific OCR engine version. PiperOrigin-RevId: 465402148 Source-Link: googleapis/googleapis@ad64930 Source-Link: https://github.com/googleapis/googleapis-gen/commit/5d2c8b2b1cb0d15bf7243513a5543a9ec3ecd778 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWQyYzhiMmIxY2IwZDE1YmY3MjQzNTEzYTU1NDNhOWVjM2VjZDc3OCJ9
1 parent 1f7e3ba commit 178e4a4

File tree

116 files changed

+2383
-736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2383
-736
lines changed

java-vision/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorProto.java

Lines changed: 141 additions & 140 deletions
Large diffs are not rendered by default.

java-vision/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/TextDetectionParams.java

Lines changed: 282 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ private TextDetectionParams(com.google.protobuf.GeneratedMessageV3.Builder<?> bu
3838
super(builder);
3939
}
4040

41-
private TextDetectionParams() {}
41+
private TextDetectionParams() {
42+
advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
43+
}
4244

4345
@java.lang.Override
4446
@SuppressWarnings({"unused"})
@@ -59,6 +61,7 @@ private TextDetectionParams(
5961
if (extensionRegistry == null) {
6062
throw new java.lang.NullPointerException();
6163
}
64+
int mutable_bitField0_ = 0;
6265
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
6366
com.google.protobuf.UnknownFieldSet.newBuilder();
6467
try {
@@ -74,6 +77,16 @@ private TextDetectionParams(
7477
enableTextDetectionConfidenceScore_ = input.readBool();
7578
break;
7679
}
80+
case 90:
81+
{
82+
java.lang.String s = input.readStringRequireUtf8();
83+
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
84+
advancedOcrOptions_ = new com.google.protobuf.LazyStringArrayList();
85+
mutable_bitField0_ |= 0x00000001;
86+
}
87+
advancedOcrOptions_.add(s);
88+
break;
89+
}
7790
default:
7891
{
7992
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
@@ -90,6 +103,9 @@ private TextDetectionParams(
90103
} catch (java.io.IOException e) {
91104
throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
92105
} finally {
106+
if (((mutable_bitField0_ & 0x00000001) != 0)) {
107+
advancedOcrOptions_ = advancedOcrOptions_.getUnmodifiableView();
108+
}
93109
this.unknownFields = unknownFields.build();
94110
makeExtensionsImmutable();
95111
}
@@ -130,6 +146,67 @@ public boolean getEnableTextDetectionConfidenceScore() {
130146
return enableTextDetectionConfidenceScore_;
131147
}
132148

149+
public static final int ADVANCED_OCR_OPTIONS_FIELD_NUMBER = 11;
150+
private com.google.protobuf.LazyStringList advancedOcrOptions_;
151+
/**
152+
*
153+
*
154+
* <pre>
155+
* A list of advanced OCR options to fine-tune OCR behavior.
156+
* </pre>
157+
*
158+
* <code>repeated string advanced_ocr_options = 11;</code>
159+
*
160+
* @return A list containing the advancedOcrOptions.
161+
*/
162+
public com.google.protobuf.ProtocolStringList getAdvancedOcrOptionsList() {
163+
return advancedOcrOptions_;
164+
}
165+
/**
166+
*
167+
*
168+
* <pre>
169+
* A list of advanced OCR options to fine-tune OCR behavior.
170+
* </pre>
171+
*
172+
* <code>repeated string advanced_ocr_options = 11;</code>
173+
*
174+
* @return The count of advancedOcrOptions.
175+
*/
176+
public int getAdvancedOcrOptionsCount() {
177+
return advancedOcrOptions_.size();
178+
}
179+
/**
180+
*
181+
*
182+
* <pre>
183+
* A list of advanced OCR options to fine-tune OCR behavior.
184+
* </pre>
185+
*
186+
* <code>repeated string advanced_ocr_options = 11;</code>
187+
*
188+
* @param index The index of the element to return.
189+
* @return The advancedOcrOptions at the given index.
190+
*/
191+
public java.lang.String getAdvancedOcrOptions(int index) {
192+
return advancedOcrOptions_.get(index);
193+
}
194+
/**
195+
*
196+
*
197+
* <pre>
198+
* A list of advanced OCR options to fine-tune OCR behavior.
199+
* </pre>
200+
*
201+
* <code>repeated string advanced_ocr_options = 11;</code>
202+
*
203+
* @param index The index of the value to return.
204+
* @return The bytes of the advancedOcrOptions at the given index.
205+
*/
206+
public com.google.protobuf.ByteString getAdvancedOcrOptionsBytes(int index) {
207+
return advancedOcrOptions_.getByteString(index);
208+
}
209+
133210
private byte memoizedIsInitialized = -1;
134211

135212
@java.lang.Override
@@ -147,6 +224,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
147224
if (enableTextDetectionConfidenceScore_ != false) {
148225
output.writeBool(9, enableTextDetectionConfidenceScore_);
149226
}
227+
for (int i = 0; i < advancedOcrOptions_.size(); i++) {
228+
com.google.protobuf.GeneratedMessageV3.writeString(output, 11, advancedOcrOptions_.getRaw(i));
229+
}
150230
unknownFields.writeTo(output);
151231
}
152232

@@ -161,6 +241,14 @@ public int getSerializedSize() {
161241
com.google.protobuf.CodedOutputStream.computeBoolSize(
162242
9, enableTextDetectionConfidenceScore_);
163243
}
244+
{
245+
int dataSize = 0;
246+
for (int i = 0; i < advancedOcrOptions_.size(); i++) {
247+
dataSize += computeStringSizeNoTag(advancedOcrOptions_.getRaw(i));
248+
}
249+
size += dataSize;
250+
size += 1 * getAdvancedOcrOptionsList().size();
251+
}
164252
size += unknownFields.getSerializedSize();
165253
memoizedSize = size;
166254
return size;
@@ -179,6 +267,7 @@ public boolean equals(final java.lang.Object obj) {
179267

180268
if (getEnableTextDetectionConfidenceScore() != other.getEnableTextDetectionConfidenceScore())
181269
return false;
270+
if (!getAdvancedOcrOptionsList().equals(other.getAdvancedOcrOptionsList())) return false;
182271
if (!unknownFields.equals(other.unknownFields)) return false;
183272
return true;
184273
}
@@ -194,6 +283,10 @@ public int hashCode() {
194283
hash =
195284
(53 * hash)
196285
+ com.google.protobuf.Internal.hashBoolean(getEnableTextDetectionConfidenceScore());
286+
if (getAdvancedOcrOptionsCount() > 0) {
287+
hash = (37 * hash) + ADVANCED_OCR_OPTIONS_FIELD_NUMBER;
288+
hash = (53 * hash) + getAdvancedOcrOptionsList().hashCode();
289+
}
197290
hash = (29 * hash) + unknownFields.hashCode();
198291
memoizedHashCode = hash;
199292
return hash;
@@ -342,6 +435,8 @@ public Builder clear() {
342435
super.clear();
343436
enableTextDetectionConfidenceScore_ = false;
344437

438+
advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
439+
bitField0_ = (bitField0_ & ~0x00000001);
345440
return this;
346441
}
347442

@@ -369,7 +464,13 @@ public com.google.cloud.vision.v1.TextDetectionParams build() {
369464
public com.google.cloud.vision.v1.TextDetectionParams buildPartial() {
370465
com.google.cloud.vision.v1.TextDetectionParams result =
371466
new com.google.cloud.vision.v1.TextDetectionParams(this);
467+
int from_bitField0_ = bitField0_;
372468
result.enableTextDetectionConfidenceScore_ = enableTextDetectionConfidenceScore_;
469+
if (((bitField0_ & 0x00000001) != 0)) {
470+
advancedOcrOptions_ = advancedOcrOptions_.getUnmodifiableView();
471+
bitField0_ = (bitField0_ & ~0x00000001);
472+
}
473+
result.advancedOcrOptions_ = advancedOcrOptions_;
373474
onBuilt();
374475
return result;
375476
}
@@ -422,6 +523,16 @@ public Builder mergeFrom(com.google.cloud.vision.v1.TextDetectionParams other) {
422523
if (other.getEnableTextDetectionConfidenceScore() != false) {
423524
setEnableTextDetectionConfidenceScore(other.getEnableTextDetectionConfidenceScore());
424525
}
526+
if (!other.advancedOcrOptions_.isEmpty()) {
527+
if (advancedOcrOptions_.isEmpty()) {
528+
advancedOcrOptions_ = other.advancedOcrOptions_;
529+
bitField0_ = (bitField0_ & ~0x00000001);
530+
} else {
531+
ensureAdvancedOcrOptionsIsMutable();
532+
advancedOcrOptions_.addAll(other.advancedOcrOptions_);
533+
}
534+
onChanged();
535+
}
425536
this.mergeUnknownFields(other.unknownFields);
426537
onChanged();
427538
return this;
@@ -451,6 +562,8 @@ public Builder mergeFrom(
451562
return this;
452563
}
453564

565+
private int bitField0_;
566+
454567
private boolean enableTextDetectionConfidenceScore_;
455568
/**
456569
*
@@ -509,6 +622,174 @@ public Builder clearEnableTextDetectionConfidenceScore() {
509622
return this;
510623
}
511624

625+
private com.google.protobuf.LazyStringList advancedOcrOptions_ =
626+
com.google.protobuf.LazyStringArrayList.EMPTY;
627+
628+
private void ensureAdvancedOcrOptionsIsMutable() {
629+
if (!((bitField0_ & 0x00000001) != 0)) {
630+
advancedOcrOptions_ = new com.google.protobuf.LazyStringArrayList(advancedOcrOptions_);
631+
bitField0_ |= 0x00000001;
632+
}
633+
}
634+
/**
635+
*
636+
*
637+
* <pre>
638+
* A list of advanced OCR options to fine-tune OCR behavior.
639+
* </pre>
640+
*
641+
* <code>repeated string advanced_ocr_options = 11;</code>
642+
*
643+
* @return A list containing the advancedOcrOptions.
644+
*/
645+
public com.google.protobuf.ProtocolStringList getAdvancedOcrOptionsList() {
646+
return advancedOcrOptions_.getUnmodifiableView();
647+
}
648+
/**
649+
*
650+
*
651+
* <pre>
652+
* A list of advanced OCR options to fine-tune OCR behavior.
653+
* </pre>
654+
*
655+
* <code>repeated string advanced_ocr_options = 11;</code>
656+
*
657+
* @return The count of advancedOcrOptions.
658+
*/
659+
public int getAdvancedOcrOptionsCount() {
660+
return advancedOcrOptions_.size();
661+
}
662+
/**
663+
*
664+
*
665+
* <pre>
666+
* A list of advanced OCR options to fine-tune OCR behavior.
667+
* </pre>
668+
*
669+
* <code>repeated string advanced_ocr_options = 11;</code>
670+
*
671+
* @param index The index of the element to return.
672+
* @return The advancedOcrOptions at the given index.
673+
*/
674+
public java.lang.String getAdvancedOcrOptions(int index) {
675+
return advancedOcrOptions_.get(index);
676+
}
677+
/**
678+
*
679+
*
680+
* <pre>
681+
* A list of advanced OCR options to fine-tune OCR behavior.
682+
* </pre>
683+
*
684+
* <code>repeated string advanced_ocr_options = 11;</code>
685+
*
686+
* @param index The index of the value to return.
687+
* @return The bytes of the advancedOcrOptions at the given index.
688+
*/
689+
public com.google.protobuf.ByteString getAdvancedOcrOptionsBytes(int index) {
690+
return advancedOcrOptions_.getByteString(index);
691+
}
692+
/**
693+
*
694+
*
695+
* <pre>
696+
* A list of advanced OCR options to fine-tune OCR behavior.
697+
* </pre>
698+
*
699+
* <code>repeated string advanced_ocr_options = 11;</code>
700+
*
701+
* @param index The index to set the value at.
702+
* @param value The advancedOcrOptions to set.
703+
* @return This builder for chaining.
704+
*/
705+
public Builder setAdvancedOcrOptions(int index, java.lang.String value) {
706+
if (value == null) {
707+
throw new NullPointerException();
708+
}
709+
ensureAdvancedOcrOptionsIsMutable();
710+
advancedOcrOptions_.set(index, value);
711+
onChanged();
712+
return this;
713+
}
714+
/**
715+
*
716+
*
717+
* <pre>
718+
* A list of advanced OCR options to fine-tune OCR behavior.
719+
* </pre>
720+
*
721+
* <code>repeated string advanced_ocr_options = 11;</code>
722+
*
723+
* @param value The advancedOcrOptions to add.
724+
* @return This builder for chaining.
725+
*/
726+
public Builder addAdvancedOcrOptions(java.lang.String value) {
727+
if (value == null) {
728+
throw new NullPointerException();
729+
}
730+
ensureAdvancedOcrOptionsIsMutable();
731+
advancedOcrOptions_.add(value);
732+
onChanged();
733+
return this;
734+
}
735+
/**
736+
*
737+
*
738+
* <pre>
739+
* A list of advanced OCR options to fine-tune OCR behavior.
740+
* </pre>
741+
*
742+
* <code>repeated string advanced_ocr_options = 11;</code>
743+
*
744+
* @param values The advancedOcrOptions to add.
745+
* @return This builder for chaining.
746+
*/
747+
public Builder addAllAdvancedOcrOptions(java.lang.Iterable<java.lang.String> values) {
748+
ensureAdvancedOcrOptionsIsMutable();
749+
com.google.protobuf.AbstractMessageLite.Builder.addAll(values, advancedOcrOptions_);
750+
onChanged();
751+
return this;
752+
}
753+
/**
754+
*
755+
*
756+
* <pre>
757+
* A list of advanced OCR options to fine-tune OCR behavior.
758+
* </pre>
759+
*
760+
* <code>repeated string advanced_ocr_options = 11;</code>
761+
*
762+
* @return This builder for chaining.
763+
*/
764+
public Builder clearAdvancedOcrOptions() {
765+
advancedOcrOptions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
766+
bitField0_ = (bitField0_ & ~0x00000001);
767+
onChanged();
768+
return this;
769+
}
770+
/**
771+
*
772+
*
773+
* <pre>
774+
* A list of advanced OCR options to fine-tune OCR behavior.
775+
* </pre>
776+
*
777+
* <code>repeated string advanced_ocr_options = 11;</code>
778+
*
779+
* @param value The bytes of the advancedOcrOptions to add.
780+
* @return This builder for chaining.
781+
*/
782+
public Builder addAdvancedOcrOptionsBytes(com.google.protobuf.ByteString value) {
783+
if (value == null) {
784+
throw new NullPointerException();
785+
}
786+
checkByteStringIsUtf8(value);
787+
ensureAdvancedOcrOptionsIsMutable();
788+
advancedOcrOptions_.add(value);
789+
onChanged();
790+
return this;
791+
}
792+
512793
@java.lang.Override
513794
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
514795
return super.setUnknownFields(unknownFields);

0 commit comments

Comments
 (0)