Skip to content

Commit fea9d17

Browse files
committed
fix #68
1 parent 15e8764 commit fea9d17

File tree

10 files changed

+63
-17
lines changed

10 files changed

+63
-17
lines changed

camera.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,13 @@ def find_text(self, accept, back_color):
341341
text = bin_image.find_text(accept)
342342
return text
343343

344-
def find_code(self):
345-
#self._image_lock.acquire()
344+
def find_qr_code(self):
346345
img = self.get_image()
347-
#self._image_lock.release()
348-
return img.grayscale().find_code()
346+
return img.find_qr_code()
347+
348+
def find_ar_code(self):
349+
img = self.get_image()
350+
return img.find_ar_code()
349351

350352
def cnn_classify(self, model_name=None):
351353
classifier = None

cv/image.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import cv.blob as blob
2525
import time
2626
import logging
27+
import cv2.aruco as aruco
2728

2829
tesseract_whitelists = {
2930
'alpha': "ABCDEFGHIJKLMNOPQRSTUVXYZ ",
@@ -49,6 +50,9 @@ class Image():
4950
r_from = np.float32([[0, 0], [640, 0], [640, 480], [0, 480]])
5051
r_dest = np.float32([[0, -120], [640, -120], [380, 480], [260, 480]])
5152

53+
_aruco_dict = aruco.Dictionary_get(aruco.DICT_4X4_50)
54+
_aruco_parameters = aruco.DetectorParameters_create()
55+
5256
#_face_cascade = cv2.CascadeClassifier('/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml')
5357
_face_cascade = cv2.CascadeClassifier('/usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalface.xml')
5458

@@ -250,16 +254,30 @@ def find_text(self, accept):
250254
logging.info("time: " + str(time.time() - t) + " text: " +str(text))
251255
return text
252256

253-
def find_code(self):
257+
def find_qr_code(self):
254258
text_found = None
255259
img_size = self._data.shape
256-
image_code = zbar.Image(img_size[1], img_size[0], "Y800", self._data.tostring())
260+
gray = cv2.cvtColor(self._data, cv2.COLOR_BGR2GRAY)
261+
image_code = zbar.Image(img_size[1], img_size[0], "Y800", gray.tostring())
257262
code_num = code_scanner.scan(image_code)
258263
for symbol in image_code:
259264
text_found = symbol.data
260265
break
261266
return text_found
262267

268+
def find_ar_code(self):
269+
gray = cv2.cvtColor(self._data, cv2.COLOR_BGR2GRAY)
270+
corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, self._aruco_dict, parameters=self._aruco_parameters)
271+
codes = []
272+
positions = []
273+
if ids is not None:
274+
for i in range(0, len(ids)):
275+
codes.append(ids[i][0])
276+
rect = corners[i][0]
277+
positions.append([(rect[0][0]+rect[1][0]+rect[2][0]+rect[3][0])/4,
278+
(rect[0][1]+rect[1][1]+rect[2][1]+rect[3][1])/4])
279+
return {"codes": codes, "positions": positions}
280+
263281
def to_jpeg(self):
264282
ret, jpeg_array = cv2.imencode('.jpeg', self._data)
265283
return np.array(jpeg_array).tostring()

data/program_find_code_test.data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"dom_code": "<xml xmlns=\"http://www.w3.org/1999/xhtml\"><block type=\"controls_whileUntil\" x=\"9\" y=\"103\"><field name=\"MODE\">WHILE</field><value name=\"BOOL\"><block type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></block></value><statement name=\"DO\"><block type=\"text_print\"><value name=\"TEXT\"><block type=\"coderbot_adv_findCode\"></block></value></block></statement></block></xml>", "code": "while True:\n get_prog_eng().check_end()\n get_cam().set_text(get_cam().find_code())\n", "name": "find_code_test"}
1+
{"dom_code": "<xml xmlns=\"http://www.w3.org/1999/xhtml\"><variables></variables><block type=\"controls_whileUntil\" id=\"0Mx[mSKoV~Gk1qbv5Wrn\" x=\"9\" y=\"103\"><field name=\"MODE\">WHILE</field><value name=\"BOOL\"><block type=\"logic_boolean\" id=\"q8(wB97}Y)d71cgy$yo#\"><field name=\"BOOL\">TRUE</field></block></value><statement name=\"DO\"><block type=\"text_print\" id=\"0fGi]QOF@I*b$5x^?f#A\"><value name=\"TEXT\"><block type=\"coderbot_adv_findQRCode\" id=\"zG.;=ZyX~k=YR$T(6JF*\"></block></value></block></statement></block></xml>", "code": "while True:\n get_prog_eng().check_end()\n get_cam().set_text(get_cam().find_qr_code())\n", "name": "find_code_test"}

photos/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"tag": "", "name": "DSC110.jpg"}, {"tag": "other", "name": "DSC19.jpg"}, {"tag": "other", "name": "DSC111.jpg"}, {"tag": "kiwi", "name": "DSC94.jpg"}, {"tag": "other", "name": "DSC113.jpg"}, {"tag": "other", "name": "DSC118.jpg"}, {"tag": "apple", "name": "DSC60.jpg"}, {"tag": "other", "name": "DSC112.jpg"}, {"tag": "apple", "name": "DSC38.jpg"}, {"tag": "kiwi", "name": "DSC73.jpg"}, {"tag": "apple", "name": "DSC49.jpg"}, {"tag": "other", "name": "DSC24.jpg"}, {"tag": "kiwi", "name": "DSC74.jpg"}, {"tag": "kiwi", "name": "DSC96.jpg"}, {"tag": "kiwi", "name": "DSC97.jpg"}, {"tag": "apple", "name": "DSC48.jpg"}, {"tag": "other", "name": "DSC121.jpg"}, {"tag": "other", "name": "DSC15.jpg"}, {"tag": "other", "name": "DSC3.jpg"}, {"tag": "other", "name": "DSC9.jpg"}, {"tag": "other", "name": "DSC115.jpg"}, {"tag": "apple", "name": "DSC30.jpg"}, {"tag": "other", "name": "DSC22.jpg"}, {"tag": "other", "name": "DSC103.jpg"}, {"tag": "kiwi", "name": "DSC86.jpg"}, {"tag": "apple", "name": "DSC35.jpg"}, {"tag": "apple", "name": "DSC34.jpg"}, {"tag": "other", "name": "DSC100.jpg"}, {"tag": "apple", "name": "DSC29.jpg"}, {"tag": "apple", "name": "DSC61.jpg"}, {"tag": "kiwi", "name": "DSC77.jpg"}, {"tag": "kiwi", "name": "DSC95.jpg"}, {"tag": "kiwi", "name": "DSC93.jpg"}, {"tag": "kiwi", "name": "DSC89.jpg"}, {"tag": "kiwi", "name": "DSC62.jpg"}, {"name": "DSC10.jpg"}, {"tag": "other", "name": "DSC108.jpg"}, {"tag": "kiwi", "name": "DSC80.jpg"}, {"tag": "apple", "name": "DSC65.jpg"}, {"tag": "other", "name": "DSC123.jpg"}, {"tag": "apple", "name": "DSC55.jpg"}, {"tag": "apple", "name": "DSC50.jpg"}, {"name": "DSC4.jpg"}, {"tag": "kiwi", "name": "DSC75.jpg"}, {"tag": "other", "name": "DSC8.jpg"}, {"tag": "kiwi", "name": "DSC85.jpg"}, {"tag": "other", "name": "DSC104.jpg"}, {"tag": "kiwi", "name": "DSC88.jpg"}, {"tag": "apple", "name": "DSC59.jpg"}, {"tag": "apple", "name": "DSC41.jpg"}, {"tag": "other", "name": "DSC13.jpg"}, {"tag": "apple", "name": "DSC40.jpg"}, {"tag": "apple", "name": "DSC37.jpg"}, {"tag": "kiwi", "name": "DSC87.jpg"}, {"tag": "other", "name": "DSC14.jpg"}, {"tag": "apple", "name": "DSC64.jpg"}, {"tag": "other", "name": "DSC12.jpg"}, {"tag": "apple", "name": "DSC57.jpg"}, {"tag": "kiwi", "name": "DSC83.jpg"}, {"tag": "kiwi", "name": "DSC70.jpg"}, {"name": "DSC21.jpg"}, {"name": "DSC98.jpg"}, {"name": "DSC23.jpg"}, {"name": "DSC120.jpg"}, {"name": "DSC99.jpg"}, {"tag": "apple", "name": "DSC46.jpg"}, {"name": "DSC107.jpg"}, {"tag": "apple", "name": "DSC66.jpg"}, {"tag": "apple", "name": "DSC31.jpg"}, {"tag": "", "name": "DSC36.jpg"}, {"tag": "apple", "name": "DSC47.jpg"}, {"name": "DSC11.jpg"}, {"tag": "kiwi", "name": "DSC76.jpg"}, {"tag": "kiwi", "name": "DSC82.jpg"}, {"name": "DSC106.jpg"}, {"name": "DSC56.jpg"}, {"name": "DSC67.jpg"}, {"name": "DSC42.jpg"}, {"name": "DSC45.jpg"}, {"name": "DSC54.jpg"}, {"name": "DSC68.jpg"}, {"tag": "other", "name": "DSC5.jpg"}, {"tag": "other", "name": "DSC25.jpg"}, {"name": "DSC44.jpg"}, {"tag": "kiwi", "name": "DSC81.jpg"}, {"tag": "apple", "name": "DSC27.jpg"}, {"tag": "other", "name": "DSC124.jpg"}, {"tag": "other", "name": "DSC114.jpg"}, {"name": "DSC69.jpg"}, {"tag": "kiwi", "name": "DSC72.jpg"}, {"tag": "other", "name": "DSC18.jpg"}, {"tag": "other", "name": "DSC20.jpg"}, {"tag": "apple", "name": "DSC63.jpg"}, {"tag": "apple", "name": "DSC52.jpg"}, {"name": "DSC7.jpg"}, {"tag": "kiwi", "name": "DSC84.jpg"}, {"tag": "apple", "name": "DSC53.jpg"}, {"name": "DSC102.jpg"}, {"tag": "kiwi", "name": "DSC90.jpg"}, {"tag": "other", "name": "DSC109.jpg"}, {"tag": "other", "name": "DSC119.jpg"}, {"name": "DSC6.jpg"}, {"tag": "apple", "name": "DSC33.jpg"}, {"tag": "apple", "name": "DSC32.jpg"}, {"tag": "kiwi", "name": "DSC71.jpg"}, {"tag": "other", "name": "DSC116.jpg"}, {"tag": "apple", "name": "DSC51.jpg"}, {"tag": "other", "name": "DSC101.jpg"}, {"tag": "kiwi", "name": "DSC79.jpg"}, {"tag": "other", "name": "DSC16.jpg"}, {"tag": "other", "name": "DSC28.jpg"}, {"tag": "apple", "name": "DSC26.jpg"}, {"tag": "kiwi", "name": "DSC91.jpg"}, {"tag": "apple", "name": "DSC43.jpg"}, {"tag": "other", "name": "DSC125.jpg"}, {"tag": "kiwi", "name": "DSC92.jpg"}, {"tag": "other", "name": "DSC117.jpg"}, {"tag": "apple", "name": "DSC39.jpg"}, {"tag": "other", "name": "DSC126.jpg"}, {"tag": "other", "name": "DSC17.jpg"}, {"tag": "kiwi", "name": "DSC78.jpg"}, {"tag": "other", "name": "DSC127.jpg"}, {"tag": "other", "name": "DSC122.jpg"}, {"tag": "apple", "name": "DSC58.jpg"}, {"tag": "tomato", "name": "DSC128.jpg"}, {"tag": "tomato", "name": "DSC129.jpg"}, {"tag": "tomato", "name": "DSC130.jpg"}, {"tag": "tomato", "name": "DSC131.jpg"}, {"tag": "tomato", "name": "DSC132.jpg"}, {"tag": "tomato", "name": "DSC133.jpg"}, {"tag": "tomato", "name": "DSC134.jpg"}, {"tag": "tomato", "name": "DSC135.jpg"}, {"tag": "tomato", "name": "DSC136.jpg"}, {"tag": "tomato", "name": "DSC137.jpg"}, {"tag": "", "name": "DSC138.jpg"}, {"tag": "", "name": "DSC139.jpg"}, {"tag": "tomato", "name": "DSC140.jpg"}, {"tag": "tomato", "name": "DSC141.jpg"}, {"tag": "tomato", "name": "DSC142.jpg"}, {"tag": "tomato", "name": "DSC143.jpg"}, {"tag": "tomato", "name": "DSC144.jpg"}, {"tag": "tomato", "name": "DSC145.jpg"}, {"tag": "tomato", "name": "DSC146.jpg"}, {"tag": "tomato", "name": "DSC147.jpg"}, {"name": "DSC148.jpg"}, {"tag": "tomato", "name": "DSC149.jpg"}, {"tag": "tomato", "name": "DSC150.jpg"}, {"tag": "tomato", "name": "DSC151.jpg"}, {"tag": "tomato", "name": "DSC152.jpg"}, {"tag": "tomato", "name": "DSC153.jpg"}, {"tag": "tomato", "name": "DSC154.jpg"}, {"tag": "tomato", "name": "DSC156.jpg"}, {"tag": "tomato", "name": "DSC157.jpg"}, {"name": "DSC158.jpg"}, {"name": "VID159.mp4"}, {"name": "VID160.mp4"}, {"name": "VID161.mp4"}, {"name": "VID162.mp4"}]
1+
[{"tag": "", "name": "DSC110.jpg"}, {"tag": "other", "name": "DSC19.jpg"}, {"tag": "other", "name": "DSC111.jpg"}, {"tag": "kiwi", "name": "DSC94.jpg"}, {"tag": "other", "name": "DSC113.jpg"}, {"tag": "other", "name": "DSC118.jpg"}, {"tag": "apple", "name": "DSC60.jpg"}, {"tag": "other", "name": "DSC112.jpg"}, {"tag": "apple", "name": "DSC38.jpg"}, {"tag": "kiwi", "name": "DSC73.jpg"}, {"tag": "apple", "name": "DSC49.jpg"}, {"tag": "other", "name": "DSC24.jpg"}, {"tag": "kiwi", "name": "DSC74.jpg"}, {"tag": "kiwi", "name": "DSC96.jpg"}, {"tag": "kiwi", "name": "DSC97.jpg"}, {"tag": "apple", "name": "DSC48.jpg"}, {"tag": "other", "name": "DSC121.jpg"}, {"tag": "other", "name": "DSC15.jpg"}, {"tag": "other", "name": "DSC3.jpg"}, {"tag": "other", "name": "DSC9.jpg"}, {"tag": "other", "name": "DSC115.jpg"}, {"tag": "apple", "name": "DSC30.jpg"}, {"tag": "other", "name": "DSC22.jpg"}, {"tag": "other", "name": "DSC103.jpg"}, {"tag": "kiwi", "name": "DSC86.jpg"}, {"tag": "apple", "name": "DSC35.jpg"}, {"tag": "apple", "name": "DSC34.jpg"}, {"tag": "other", "name": "DSC100.jpg"}, {"tag": "apple", "name": "DSC29.jpg"}, {"tag": "apple", "name": "DSC61.jpg"}, {"tag": "kiwi", "name": "DSC77.jpg"}, {"tag": "kiwi", "name": "DSC95.jpg"}, {"tag": "kiwi", "name": "DSC93.jpg"}, {"tag": "kiwi", "name": "DSC89.jpg"}, {"tag": "kiwi", "name": "DSC62.jpg"}, {"name": "DSC10.jpg"}, {"tag": "other", "name": "DSC108.jpg"}, {"tag": "kiwi", "name": "DSC80.jpg"}, {"tag": "apple", "name": "DSC65.jpg"}, {"tag": "other", "name": "DSC123.jpg"}, {"tag": "apple", "name": "DSC55.jpg"}, {"tag": "apple", "name": "DSC50.jpg"}, {"name": "DSC4.jpg"}, {"tag": "kiwi", "name": "DSC75.jpg"}, {"tag": "other", "name": "DSC8.jpg"}, {"tag": "kiwi", "name": "DSC85.jpg"}, {"tag": "other", "name": "DSC104.jpg"}, {"tag": "kiwi", "name": "DSC88.jpg"}, {"tag": "apple", "name": "DSC59.jpg"}, {"tag": "apple", "name": "DSC41.jpg"}, {"tag": "other", "name": "DSC13.jpg"}, {"tag": "apple", "name": "DSC40.jpg"}, {"tag": "apple", "name": "DSC37.jpg"}, {"tag": "kiwi", "name": "DSC87.jpg"}, {"tag": "other", "name": "DSC14.jpg"}, {"tag": "apple", "name": "DSC64.jpg"}, {"tag": "other", "name": "DSC12.jpg"}, {"tag": "apple", "name": "DSC57.jpg"}, {"tag": "kiwi", "name": "DSC83.jpg"}, {"tag": "kiwi", "name": "DSC70.jpg"}, {"name": "DSC21.jpg"}, {"name": "DSC98.jpg"}, {"name": "DSC23.jpg"}, {"name": "DSC120.jpg"}, {"name": "DSC99.jpg"}, {"tag": "apple", "name": "DSC46.jpg"}, {"name": "DSC107.jpg"}, {"tag": "apple", "name": "DSC66.jpg"}, {"tag": "apple", "name": "DSC31.jpg"}, {"tag": "", "name": "DSC36.jpg"}, {"tag": "apple", "name": "DSC47.jpg"}, {"name": "DSC11.jpg"}, {"tag": "kiwi", "name": "DSC76.jpg"}, {"tag": "kiwi", "name": "DSC82.jpg"}, {"name": "DSC106.jpg"}, {"name": "DSC56.jpg"}, {"name": "DSC67.jpg"}, {"name": "DSC42.jpg"}, {"name": "DSC45.jpg"}, {"name": "DSC54.jpg"}, {"name": "DSC68.jpg"}, {"tag": "other", "name": "DSC5.jpg"}, {"tag": "other", "name": "DSC25.jpg"}, {"name": "DSC44.jpg"}, {"tag": "kiwi", "name": "DSC81.jpg"}, {"tag": "apple", "name": "DSC27.jpg"}, {"tag": "other", "name": "DSC124.jpg"}, {"tag": "other", "name": "DSC114.jpg"}, {"name": "DSC69.jpg"}, {"tag": "kiwi", "name": "DSC72.jpg"}, {"tag": "other", "name": "DSC18.jpg"}, {"tag": "other", "name": "DSC20.jpg"}, {"tag": "apple", "name": "DSC63.jpg"}, {"tag": "apple", "name": "DSC52.jpg"}, {"name": "DSC7.jpg"}, {"tag": "kiwi", "name": "DSC84.jpg"}, {"tag": "apple", "name": "DSC53.jpg"}, {"name": "DSC102.jpg"}, {"tag": "kiwi", "name": "DSC90.jpg"}, {"tag": "other", "name": "DSC109.jpg"}, {"tag": "other", "name": "DSC119.jpg"}, {"name": "DSC6.jpg"}, {"tag": "apple", "name": "DSC33.jpg"}, {"tag": "apple", "name": "DSC32.jpg"}, {"tag": "kiwi", "name": "DSC71.jpg"}, {"tag": "other", "name": "DSC116.jpg"}, {"tag": "apple", "name": "DSC51.jpg"}, {"tag": "other", "name": "DSC101.jpg"}, {"tag": "kiwi", "name": "DSC79.jpg"}, {"tag": "other", "name": "DSC16.jpg"}, {"tag": "other", "name": "DSC28.jpg"}, {"tag": "apple", "name": "DSC26.jpg"}, {"tag": "kiwi", "name": "DSC91.jpg"}, {"tag": "apple", "name": "DSC43.jpg"}, {"tag": "other", "name": "DSC125.jpg"}, {"tag": "kiwi", "name": "DSC92.jpg"}, {"tag": "other", "name": "DSC117.jpg"}, {"tag": "apple", "name": "DSC39.jpg"}, {"tag": "other", "name": "DSC126.jpg"}, {"tag": "other", "name": "DSC17.jpg"}, {"tag": "kiwi", "name": "DSC78.jpg"}, {"tag": "other", "name": "DSC127.jpg"}, {"tag": "other", "name": "DSC122.jpg"}, {"tag": "apple", "name": "DSC58.jpg"}, {"tag": "tomato", "name": "DSC128.jpg"}, {"tag": "tomato", "name": "DSC129.jpg"}, {"tag": "tomato", "name": "DSC130.jpg"}, {"tag": "tomato", "name": "DSC131.jpg"}, {"tag": "tomato", "name": "DSC132.jpg"}, {"tag": "tomato", "name": "DSC133.jpg"}, {"tag": "tomato", "name": "DSC134.jpg"}, {"tag": "tomato", "name": "DSC135.jpg"}, {"tag": "tomato", "name": "DSC136.jpg"}, {"tag": "tomato", "name": "DSC137.jpg"}, {"tag": "", "name": "DSC138.jpg"}, {"tag": "", "name": "DSC139.jpg"}, {"tag": "tomato", "name": "DSC140.jpg"}, {"tag": "tomato", "name": "DSC141.jpg"}, {"tag": "tomato", "name": "DSC142.jpg"}, {"tag": "tomato", "name": "DSC143.jpg"}, {"tag": "tomato", "name": "DSC144.jpg"}, {"tag": "tomato", "name": "DSC145.jpg"}, {"tag": "tomato", "name": "DSC146.jpg"}, {"tag": "tomato", "name": "DSC147.jpg"}, {"name": "DSC148.jpg"}, {"tag": "tomato", "name": "DSC149.jpg"}, {"tag": "tomato", "name": "DSC150.jpg"}, {"tag": "tomato", "name": "DSC151.jpg"}, {"tag": "tomato", "name": "DSC152.jpg"}, {"tag": "tomato", "name": "DSC153.jpg"}, {"tag": "tomato", "name": "DSC154.jpg"}, {"tag": "tomato", "name": "DSC156.jpg"}, {"tag": "tomato", "name": "DSC157.jpg"}, {"name": "DSC158.jpg"}, {"name": "DSC176.jpg"}, {"name": "DSC177.jpg"}, {"name": "DSC178.jpg"}, {"name": "DSC179.jpg"}, {"name": "DSC180.jpg"}, {"name": "DSC181.jpg"}]

static/js/blockly/blocks.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ Blockly.Python['coderbot_adv_findText'] = function(block) {
649649
return [code, Blockly.Python.ORDER_ATOMIC];
650650
};
651651

652-
Blockly.Blocks['coderbot_adv_findCode'] = {
652+
Blockly.Blocks['coderbot_adv_findQRCode'] = {
653653
/**
654654
* Block for findText function.
655655
* @this Blockly.Block
@@ -658,16 +658,38 @@ Blockly.Blocks['coderbot_adv_findCode'] = {
658658
this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);
659659
this.setColour(250);
660660
this.appendDummyInput()
661-
.appendField(Blockly.Msg.CODERBOT_SENSOR_FINDCODE);
661+
.appendField(Blockly.Msg.CODERBOT_SENSOR_FINDQRCODE);
662662
this.setOutput(true, 'String');
663663
this.setInputsInline(true);
664664
this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
665665
}
666666
};
667667

668-
Blockly.Python['coderbot_adv_findCode'] = function(block) {
668+
Blockly.Python['coderbot_adv_findQRCode'] = function(block) {
669669
// Boolean values true and false.
670-
var code = 'get_cam().find_code()';
670+
var code = 'get_cam().find_qr_code()';
671+
return [code, Blockly.Python.ORDER_ATOMIC];
672+
};
673+
674+
Blockly.Blocks['coderbot_adv_findARCode'] = {
675+
/**
676+
* Block for findText function.
677+
* @this Blockly.Block
678+
*/
679+
init: function() {
680+
this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);
681+
this.setColour(250);
682+
this.appendDummyInput()
683+
.appendField(Blockly.Msg.CODERBOT_SENSOR_FINDARCODE);
684+
this.setOutput(true, 'String');
685+
this.setInputsInline(true);
686+
this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
687+
}
688+
};
689+
690+
Blockly.Python['coderbot_adv_findARCode'] = function(block) {
691+
// Boolean values true and false.
692+
var code = 'get_cam().find_ar_code()';
671693
return [code, Blockly.Python.ORDER_ATOMIC];
672694
};
673695

static/js/blockly/bot_en.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_NUM = "Numeric (0..9)";
6363
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_ALPHANUM = "Alphanumeric (A..Z;0..9)";
6464
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_UNSPEC = "Any";
6565
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_COLOR = "background color";
66-
Blockly.Msg.CODERBOT_SENSOR_FINDCODE = "read Bar-QRCode";
66+
Blockly.Msg.CODERBOT_SENSOR_FINDQRCODE = "read Bar-QRCode";
67+
Blockly.Msg.CODERBOT_SENSOR_FINDQRCODE = "read AR Code";
6768
Blockly.Msg.CODERBOT_AUDIO_RECORD_FILE_NAME = "record as file";
6869
Blockly.Msg.CODERBOT_AUDIO_RECORD_FILE_ELAPSE = " of seconds";
6970
Blockly.Msg.CODERBOT_AUDIO_PLAY_FILE = "play file";

static/js/blockly/bot_fr.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_NUM = "Numeric (0..9)";
6363
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_ALPHANUM = "Alphanumeric (A..Z;0..9)";
6464
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_UNSPEC = "Any";
6565
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_COLOR = "background color";
66-
Blockly.Msg.CODERBOT_SENSOR_FINDCODE = "trouve le Bar/QRCode";
66+
Blockly.Msg.CODERBOT_SENSOR_FINDQRCODE = "trouve le Bar/QRCode";
67+
Blockly.Msg.CODERBOT_SENSOR_FINDARCODE = "trouve le AR Code";
6768
Blockly.Msg.CODERBOT_AUDIO_RECORD_FILE_NAME = "record as file";
6869
Blockly.Msg.CODERBOT_AUDIO_RECORD_FILE_ELAPSE = " of seconds";
6970
Blockly.Msg.CODERBOT_AUDIO_PLAY_FILE = "play file";

static/js/blockly/bot_it.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_NUM = "Numeri (0..9)";
6363
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_ALPHANUM = "Lettere e numeri (A..Z;0..9)";
6464
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_ACCEPT_UNSPEC = "Qualsiasi";
6565
Blockly.Msg.CODERBOT_SENSOR_FINDTEXT_COLOR = "colore sfondo";
66-
Blockly.Msg.CODERBOT_SENSOR_FINDCODE = "leggi Bar/QRCode";
66+
Blockly.Msg.CODERBOT_SENSOR_FINDQRCODE = "leggi Bar/QRCode";
67+
Blockly.Msg.CODERBOT_SENSOR_FINDARCODE = "leggi AR Code";
6768
Blockly.Msg.CODERBOT_AUDIO_RECORD_FILE_NAME = "registra audio su file";
6869
Blockly.Msg.CODERBOT_AUDIO_RECORD_FILE_ELAPSE = " per secondi";
6970
Blockly.Msg.CODERBOT_AUDIO_PLAY_FILE = "riproduci file";

static/js/control.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ $(document).on( "pageshow", '#page-photos', function( event ) {
233233
}
234234
for(p in data) {
235235
var media = data[p];
236-
media.thumb = media.name.replace('.jpg', '_thumb.jpg');
237236
media.type = media.name.indexOf('jpg') > 0 ? 'photo' : 'video';
237+
media.thumb = media.name.replace(media.name.substring(media.name.length-4), '_thumb.jpg');
238238
var tags_select = '<select class="s_media_tag" data-mini="true">';
239239
tags_select += '<option value=""' + (media.tag ? '' : ' selected') + '></option>';
240240
for(t in tags) {

templates/blocks_adv.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@
297297
</block>
298298
</value>
299299
</block>
300-
<block type="coderbot_adv_findCode"></block>
300+
<block type="coderbot_adv_findQRCode"></block>
301+
<block type="coderbot_adv_findARCode"></block>
301302
<block type="coderbot_adv_find_class"></block>
302303
<block type="coderbot_adv_cnn_classify"></block>
303304
<block type="coderbot_sonar_get_distance"></block>

0 commit comments

Comments
 (0)