小编Mar*_*us0的帖子

折线使用google maps api v3对齐

在google maps api v2中很简单,

var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(53.7877, -2.9832),13)
//    map.addControl(new GLargeMapControl());
//    map.addControl(new GMapTypeControl());
    var dirn = new GDirections();

//      var firstpoint = true;
    var gmarkers = [];
    var gpolys = [];
    var dist = 0;

// == When the user clicks on a the map, get directiobns from that point to itself ==

gmarkers.push(new google.maps.LatLng(53.7877, -2.9832));
gmarkers.push(new google.maps.LatLng(53.9007, -2.9832));
gmarkers.push(new GLatLng(53.600, -2.700));



for (var i = 0; i < gmarkers.length-1; i++) {
    console.log(gmarkers[i]);
                dirn.loadFromWaypoints([gmarkers[i].toUrlValue(6),gmarkers[i+1].toUrlValue(6)],{getPolyline:true});

} …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3

25
推荐指数
1
解决办法
5万
查看次数

Matcher Assertions失败错误opencv Android

我正在编写代码来从camerapreview中的drawable中找到类似的对象.我使用的是最新的Opencv 2.4.4.

下面是我的函数和logcat的输出.我得到这样的输出我做错了什么?

 public void detect_image (Mat mRgba) {

    object_desc = new Mat();
    scene_desc = new Mat();

    object_keys = new MatOfKeyPoint();
    scene_keys = new MatOfKeyPoint();

    matches = new MatOfDMatch();
    good_matches = new MatOfDMatch();

    Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.sto);
    Utils.bitmapToMat(image,object);   

    surf = FeatureDetector.create(FeatureDetector.FAST);
    surf.detect( object, object_keys );   
    surf.detect( mRgba, scene_keys);
    surfEX = DescriptorExtractor.create(DescriptorExtractor.BRIEF);
    surfEX.compute(object, object_keys, object_desc);       
    surfEX.compute(mRgba, scene_keys, scene_desc);
    dm = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2);    
    dm.match(object_desc, scene_desc, matches);

    double max_dist = 0;
    double min_dist = 100;

    for( int i = 0; i < object_desc.rows(); …
Run Code Online (Sandbox Code Playgroud)

android opencv image-processing

17
推荐指数
1
解决办法
6181
查看次数

并行图像检测和相机预览OpenCV Android

我正在使用OpenCV来检测图像.这是我的问题:我的函数detect_image(mRgba)需要一些时间来执行操作并给出一些结果.虽然功能是计算相机预览被冻结,因为它只显示代码到达时的图像return inputFrame.rgba()我想知道如何使这些操作并行,功能将在后台计算,而相机预览正常工作.

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
mRgba = inputFrame.rgba();
detect_image(mRgba);
return inputFrame.rgba();
}
Run Code Online (Sandbox Code Playgroud)

android opencv image-processing

5
推荐指数
1
解决办法
3221
查看次数

为什么Google Maps DirectionsService会返回不同的路线?

我对Google Maps DirectionsService有一些奇怪的问题.如果输入数据相同,它会返回不同的路径.这是我的代码示例

var path = [];
path.push(new google.maps.LatLng(51.10600101811778, 17.025117874145508));
path.push(new google.maps.LatLng(51.1047951799623,17.02278971672058));
path.push(new google.maps.LatLng(51.10456276619924, 17.02208161354065));
path.push(new google.maps.LatLng(51.10131895649719, 17.029248476028442));
path.push(new google.maps.LatLng(51.100331957810134, 17.033969163894653));
path.push(new google.maps.LatLng(51.10001867395775, 17.032413482666016));

for (var i = 0; i <path.length-1; i++) {
    var request = {
        origin: path[i],
        destination: path[i+1],
        travelMode: google.maps.DirectionsTravelMode.WALKING
    }

    directionsService.route(request, function(results, status) {
        if (status == google.maps.DirectionsStatus.OK) {
            selected_path = selected_path.concat(results.routes[0].overview_path);
            poly.setPath(selected_path);
            poly.setMap(map);
        }
    })
}
Run Code Online (Sandbox Code Playgroud)

调用后第一次,函数绘制一条奇怪的折线,始终将起点与终点连接起来:

第二次调用它时,该函数运行良好,并正确绘制路径:

它只是输入静态数据的一个例子.通常我使用矩阵和动态标记的动态数据,但总是一样.首先,起点与终点+其他点之间的奇怪连接相连.第二通电功能运行良好.你们中的某些人是否有一些线索如何解决这个问题?

javascript google-maps google-maps-api-3

2
推荐指数
1
解决办法
1900
查看次数

如何自定义谷歌地图方向不显示航点

我的问题是在方向列表中突出显示了航点,例如:开始航点1,航点1到航点2,......

这是一个如何看的例子:http://www.ridersguide.co.uk/Ride_721

我想展示开始和说明如何在不显示航点的情况下到达目的地点.

你有什么想法吗?

google-maps google-maps-api-3

1
推荐指数
1
解决办法
4422
查看次数

在jquery代码中调用javascript函数外部

$(function(){

function f1(){}
function f2(){}

}

<Input type = radio Name = radiobutton Value = "something" checked=checked onClick= //here call f1()//>
Run Code Online (Sandbox Code Playgroud)

我尝试在OnClick中访问f1函数

像这样的代码不起作用:

$.function.f1()
$.function().f1()
Run Code Online (Sandbox Code Playgroud)

javascript jquery

1
推荐指数
1
解决办法
163
查看次数

有没有办法等到 DirectionsService 返回结果?

我在使用 Google DirectionsService 时遇到问题。我知道它是异步的,这就是我遇到麻烦的原因。我想等到 DirectionsService 返回结果而不是在没有答案的情况下执行代码。这是一个示例:

function snap_to_road (lat) {
    var position;

    var request = {
        origin: lat,
        destination: lat,
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    };

    directionsService.route(request, function(response, status) {
        if (status == google.maps.DirectionsStatus.OK) {
            return response.routes[0].legs[0].start_location;
        }
    });
}

alert(snap_to_road(current.latLng));
Run Code Online (Sandbox Code Playgroud)

alert始终表示:“未定义”。有没有办法解决这个问题?

javascript google-maps-api-3 google-directions-api

0
推荐指数
1
解决办法
4702
查看次数