This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2014 The Chromium Authors. All rights reserved. | |
| // Redistribution and use in source and binary forms, with or without | |
| // modification, are permitted provided that the following conditions are | |
| // met: | |
| // * Redistributions of source code must retain the above copyright | |
| // notice, this list of conditions and the following disclaimer. | |
| // * Redistributions in binary form must reproduce the above | |
| // copyright notice, this list of conditions and the following |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'dart:math'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/widgets.dart'; | |
| import 'package:quiver/cache.dart'; | |
| import 'package:quiver/collection.dart'; | |
| /* | |
| class LazyList extends StatefulWidget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/widgets.dart'; | |
| class PreloadingImageBuilder extends StatefulWidget { | |
| final ImageProvider imageProvider; | |
| final AsyncWidgetBuilder<dynamic> builder; | |
| PreloadingImageBuilder({this.imageProvider, this.builder}); | |
| @override | |
| _PreloadingImageBuilderState createState() => _PreloadingImageBuilderState(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| home: Scaffold( | |
| body: Center( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build_web: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Need to draw only good matches, so create a mask | |
| matches_mask = [[0, 0] for i in range(len(flann_matches))] | |
| # ratio test as per Lowe's paper | |
| good = [] | |
| for index in range(len(flann_matches)): | |
| if len(flann_matches[index]) == 2: | |
| m, n = flann_matches[index] | |
| if m.distance < 0.8 * n.distance: # 0.8 is threshold of ratio testing | |
| matches_mask[index] = [1, 0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # FLANN parameters | |
| flann_index_lsh = 6 | |
| index_params = dict(algorithm=flann_index_lsh, | |
| table_number=12, | |
| key_size=20, | |
| multi_probe_level=2) | |
| search_params = dict(checks=100) # or pass empty dictionary | |
| # create FLANN | |
| flann = cv2.FlannBasedMatcher(index_params, search_params) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # draw key point on image | |
| result_image_train = cv2.drawKeypoints(image_train, kp_logo, None, flags=0) | |
| result_image_query = cv2.drawKeypoints(image_query, kp_img, None, flags=0) | |
| cv2.imshow("train image",result_image_train) | |
| cv2.imshow("query image",result_image_query) | |
| cv2.waitKey(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create ORB dectector | |
| orb = cv2.ORB_create(nfeatures=2000) # default features is 500 | |
| # loop into all train images. | |
| for image_train in train_image_list: | |
| # find key point and descriptor | |
| kp_logo, des_logo = orb.detectAndCompute(image_train, None) | |
| kp_img, des_img = orb.detectAndCompute(image_query, None) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def load_all_image_from_path(path): | |
| image_list = [] | |
| for filename in glob.glob(path): | |
| # load image in gray scale | |
| im = cv2.imread(filename, cv2.IMREAD_GRAYSCALE) | |
| image_list.append(im) | |
| return image_list |
NewerOlder