sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: opencv
Issue: matchTemplate with SQDIFF_NORMED clips at 1.0
Labels: bug,category: imgproc

<!--
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

Please:

* Read the documentation to test with the latest developer build.
* Check if other person has already created the same issue to avoid duplicates. You can comment on it if there already is an issue.
* Try to be as detailed as possible in your report.
* Report only one problem per created issue.


This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)
<!-- Example
- OpenCV => 3.1
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2015
-->

- OpenCV => latest master build Aug. 1 2019 (f9cefc84a35e12cbe468696a3f6c2e2c16323f14) -> 4.1.1-dev
- Operating System / Platform => Linux
- Compiler => gcc

##### Detailed description

With method `SQDIFF_NORMED` `matchTemplate()` returns 1.0 in all places where the actual result according to the formula in the [documentation](https://docs.opencv.org/master/df/dfb/group__imgproc__object.html#ga3a7850640f1fe1f58fe91a2d7583695d) it should be >1.0. Notice that in contrast to the other `_NORMED`-methods the normalization of `SQDIFF_NORMED` is mathematically not guaranteed to be <=1.

##### Steps to reproduce

<!-- to add code example fence it with triple backticks and optional file extension
    ```.cpp
    // C++ code example
    ```
 or attach as .txt or .zip file
-->
For one value:
```python
import cv2
import numpy as np

i = np.array([[5, 1],
              [2, 8]], dtype=np.float32)
t = np.array([[1, 5],
              [7, 1]], dtype=np.float32)
m = np.ones(t.shape, dtype=t.dtype)

r = cv2.matchTemplate(i, t, cv2.TM_SQDIFF_NORMED)
print(r)

# Calculate SQDIFF_NORMED by hand
sqdiff = np.sum((i - t)**2)
norm = np.sqrt(np.sum(t**2) * np.sum(i**2))
print(sqdiff/norm)
```

With a larger array: you can see that there are multiple values with value exactly 1.0, so this already seems off, if you calculate the correct value at those points you see that they should be greater.
```python
import cv2
import numpy as np

def genimg(size):
    return np.round(2*np.random.uniform(size=size).astype(np.float32))
i = genimg(42).reshape((6, 7))
t = i[:2,:2].copy()
m = np.ones(t.shape, dtype=t.dtype)
r = cv2.matchTemplate(i, t, cv2.TM_SQDIFF_NORMED)
print(r)
```
Repository: rust
Issue: rustc unable to interact with trait bound required by other required trait
Labels: T-compiler,A-lazy-normalization

This bug happens on `nightly-2019-08-01-x86_64-unknown-linux-gnu` and also a nightly I had from a month ago.

`rustc 1.38.0-nightly (8a58268b5 2019-07-31)`

I minimized my issue to the following ([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c06d680065267e09adc752a8318f0366)):

```rust
use generic_array::{GenericArray, ArrayLength};

pub struct HNSW<M: ArrayLength<u32>> {
    zero: Vec<ZeroNode<M>>,
}

struct ZeroNode<N: ArrayLength<u32>> {
    neighbors: GenericArray<u32, N>,
}

impl<M: ArrayLength<u32>> HNSW<M> {
    pub fn insert(&mut self) {
        self.zero.push(ZeroNode {
            neighbors: [!0; M::USIZE].into(),
        });
    }
}
```

`ArrayLength` has a required bound `Unsigned` from typenum which has an associated const `USIZE`. Therefore, the ArrayLength trait bound should work. The compiler adds this comment:

```rust
   Compiling playground v0.0.1 (/playground)
error[E0599]: no associated item named `USIZE` found for type `M` in the current scope
  --> src/lib.rs:14:32
   |
14 |             neighbors: [!0; M::USIZE].into(),
   |                                ^^^^^ associated item not found in `M`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `USIZE`, perhaps you need to implement it:
           candidate #1: `typenum::marker_traits::Unsigned`
```

If I do what it says, it gives the exact same issue ([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=02d82925e94dd2140fdae6e6ff4f8543)).

I then attempted to be clever and force the compiler to do the right thing ([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6df9200d2d1699a46b26688f78b597cd)):

`<M as typenum::marker_traits::Unsigned>::USIZE`:

```rust
error[E0277]: the trait bound `M: typenum::marker_traits::Unsigned` is not satisfied
  --> src/lib.rs:15:29
   |
15 |             neighbors: [!0; <M as typenum::marker_traits::Unsigned>::USIZE].into(),
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `typenum::marker_traits::Unsigned` is not implemented for `M`
   |
   = help: consider adding a `where M: typenum::marker_traits::Unsigned` bound
   = note: required by `typenum::marker_traits::Unsigned::USIZE`
```

It seems that, even when the trait is specifically required to be implemented, it still isn't implemented. This behavior is highly erroneous.

In the meantime, if anyone knows temporary workarounds for this issue, I would appreciate that. I am using this in [this](https://github.com/rust-photogrammetry/hnsw) crate.
Repository: opencv
Issue: where to get the value range of property of VideoCapture::set(id, value)?
Labels: feature,priority: low,category: videoio

<!--
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

Please:

* Read the documentation to test with the latest developer build.
* Check if other person has already created the same issue to avoid duplicates. You can comment on it if there already is an issue.
* Try to be as detailed as possible in your report.
* Report only one problem per created issue.


This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)
<!-- Example
- OpenCV => 3.1
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2015
-->

- OpenCV => :grey_question:
- Operating System / Platform => :grey_question:
- Compiler => :grey_question:

##### Detailed description

<!-- your description -->

##### Steps to reproduce

<!-- to add code example fence it with triple backticks and optional file extension
    ```.cpp
    // C++ code example
    ```
 or attach as .txt or .zip file
-->
for example, CAP_PROP_EXPOSURE, how about the low and up bound value?
Repository: flutter
Issue: PageController.nextPage should have a default duration and curve
Labels: framework,f: scrolling,c: proposal,P3,has partial patch,team-framework,triaged-framework

PageController.nextPage and PageController.previousPage should have a default duration and curve for animating the programmatic change of page. This makes the experience more standard and faster to program.
Repository: flutter
Issue: PageView should have option to respond to Back Button on Android
Labels: c: new feature,framework,f: scrolling,P3,team-framework,triaged-framework

PageView should have an option to go back to the previous page if the Back Button was pressed on Android.
Repository: PowerToys
Issue: Improved file tagging system
Labels: Idea-New PowerToy,Product-File Explorer

Tags are quite awkwardly implemented in Windows and don't seem to support many file types by default. It would be pretty neat to improve on this with a more accessible UI and things like color-coding. Being able to quickly access tags and view tagged files from the navigation pane would be nice too.

Maybe something like this is beyond the scope of PowerToys, but I'm just throwing the idea out there.
Repository: rust
Issue: The type-checker assumes that Trait<'a>::AssociatedType may be outlived by 'a, even with "where AssociatedType: 'a"
Labels: C-enhancement,A-diagnostics,A-lifetimes,A-associated-items,T-lang,T-compiler

    trait Trait<'a> {
        type Ty;
        fn method(ty_ref: &'a Self::Ty) where Self::Ty: 'a { }
    }
    
    fn caller<'a, T: Trait<'a>>(arg: &'a T::Ty) where T::Ty: 'a {
        T::method(arg)
    }

Compilation fails on the playground (for stable 1.36.0 and nightly 1.38.0) with this error:

    Compiling playground v0.0.1 (/playground)
    error[E0309]: the associated type `<T as Trait<'_>>::Ty` may not live long enough
     --> src/lib.rs:7:9
      |
    7 |         T::method(arg)
      |         ^^^^^^^^^
      |
      = help: consider adding an explicit lifetime bound `<T as Trait<'_>>::Ty: 'a`...
    note: ...so that the type `<T as Trait<'_>>::Ty` will meet its required lifetime bounds
     --> src/lib.rs:7:9
      |
    7 |         T::method(arg)
      |         ^^^^^^^^^
    
    error: aborting due to previous error

Compilation succeeds if I make any of the following changes:

- Add a lifetime constraint to `Ty` at its definition site, `type Ty: 'a;`

- Move the lifetime parameter from the trait to the method, `fn method<'a>(...)`

Compilation fails with the same error message if I change `method` into a free function:

    trait Trait<'a> {
        type Ty;
    }
    
    fn method<'a, T: Trait<'a>>(_arg: &'a T::Ty) where T::Ty: 'a { }
    
    fn caller<'a, T: Trait<'a>>(arg: &'a T::Ty) where T::Ty: 'a {
        method::<T>(arg)
    }

Even if this is intended behaviour, the error message could be improved.
Repository: pytorch
Issue: Better documentation about PyTorch's dependencies
Labels: module: build,module: docs,triaged,module: third_party

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->
Rather than or in addition to having dependencies as submodules, it would also be helpful to list them separately, indicating typical configurations and allowing the user the option of informing cmake where the dependencies are installed.

## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->

It can be frustrating to build from source with dependencies breaking the build, for example issues with the automated installation of MKL DNN and Caffe seem to break the default installation. Furthermore, each of the dependencies has a rather wide choice of configuration options that can affect performance.

## Pitch

<!-- A clear and concise description of what you want to happen. -->

An improved installation README.md document which lists the dependencies, where they are used, how the impact performance and which ones are critical.

## Alternatives

<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->

Use of Spack for installation - https://spack.io/

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
Repository: terminal
Issue: Support importing themes from other terminal apps
Labels: Issue-Feature,Area-Settings,Product-Terminal

# Description of the new feature/enhancement

Fluent Terminal has the really neat ability to import iterm themes which allows me to use themes from [rainglow](https://rainglow.io/).

I would love it if the new Windows terminal was able to do the same.  That way the community isn't waiting for all the various theme authors to recognize it (if ever!).

# Proposed technical implementation details (optional)

I'll leave it up to you guys, but the basic idea would be to just have a look at all the applications rainglow has themes for and maybe implement hyper and iterm theme import functionality.
Repository: godot
Issue: C++ Code has lack of proper reference usage and move semantics
Labels: discussion,topic:core,topic:import

While I was debugging the GLTF importer code, as it was causing some problems, I found some large problems with the source code:

It seems like there's a large lack of use of references and const correctness in the code.

There are large copies of data being used for read-only purposes throughout the GLTF importer. In fact, in most cases you can just replace the type with a const& version.

Here are some examples:

```cpp
Error EditorSceneImporterGLTF::_parse_buffers(GLTFState &state, const String &p_base_path) {

	if (!state.json.has("buffers"))
		return OK;

        // Note: Unnecessary copy
        // const Array &buffers = state.json["buffers"];
	Array buffers = state.json["buffers"];
	for (int i = 0; i < buffers.size(); i++) {

		if (i == 0 && state.glb_data.size()) {
			state.buffers.push_back(state.glb_data);

		} else {
                        // Note: Unnecessary copy
                        // const Dictionary &buffer = buffers[i];
			Dictionary buffer = buffers[i];
			if (buffer.has("uri")) {

				Vector<uint8_t> buffer_data;
				String uri = buffer["uri"];

				if (uri.findn("data:application/octet-stream;base64") == 0) {
					//embedded data
					buffer_data = _parse_base64_uri(uri);
				} else {

					uri = p_base_path.plus_file(uri).replace("\\", "/"); //fix for windows
					buffer_data = FileAccess::get_file_as_array(uri);
					ERR_FAIL_COND_V(buffer.size() == 0, ERR_PARSE_ERROR);
				}

				ERR_FAIL_COND_V(!buffer.has("byteLength"), ERR_PARSE_ERROR);
				int byteLength = buffer["byteLength"];
				ERR_FAIL_COND_V(byteLength < buffer_data.size(), ERR_PARSE_ERROR);
				state.buffers.push_back(buffer_data);
			}
		}
	}

	print_verbose("glTF: Total buffers: " + itos(state.buffers.size()));

	return OK;
}
```

This importer is also a good example of when move semantics would increase performance quite a bit.

These are some pretty large performance implications to take into account, especially when it takes over a minute to import a simple scene with an armature and 6 meshes.
Repository: rust
Issue: rustdoc: Built-in macros are not documented in all the necessary locations
Labels: T-rustdoc,A-macros,C-bug

NOTE: Some cases below assume https://github.com/rust-lang/rust/pull/63056 has landed.

- :negative_squared_cross_mark: https://doc.rust-lang.org/nightly/core/default/index.html doesn't contain the derive macro `Default`.
:heavy_check_mark: Compare with the https://doc.rust-lang.org/nightly/std/fmt/index.html page which contains the derive macro `Debug` because it's introduced through a reexport rather than directly.

- :negative_squared_cross_mark: Some built-in macros not available through the libcore root are documented in the root instead (e.g. derives) - https://doc.rust-lang.org/nightly/core/index.html.

- :heavy_check_mark: libcore prelude is documented correctly https://doc.rust-lang.org/nightly/core/prelude/v1/index.html

- :negative_squared_cross_mark: https://doc.rust-lang.org/nightly/std/default/trait.Default.html doesn't contain the derive macro `Default`.
:negative_squared_cross_mark: Note that https://doc.rust-lang.org/nightly/std/fmt/index.html doesn't contain the derive macro `Debug` as well.

- :negative_squared_cross_mark: Derive and attribute macros in libstd prelude https://doc.rust-lang.org/nightly/std/prelude/v1/index.html has to be marked with `#[doc(hidden)]` currently because otherwise they generate dead links failing the `linkchecker` testing.
As a result they do not appear on the page.
What is worse, due to `#[doc(hidden)]` some traits with names matching derives (e.g. `Default`) are also not documented at that location.
Repository: TypeScript
Issue: Support string types in dynamic import types.  
Labels: Suggestion,Awaiting More Feedback

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the "Common Feature Requests" section.

-->

## Search Terms

<!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily -->
dynamic import type 

## Suggestion

<!-- A summary of what you'd like to see added or changed -->
I'd like to define a function that wraps a dynamic `require` or `import`. Specifically, I'm writing a library that uses node's worker_thread and I want to support 'dependency injection' via dynamic import. You can't pass class instances or functions across execution contexts. 


```typescript
import { isMainThread, Worker, workerData } from 'worker_threads';

export type LoggerImportPath = ???;

export default function lib(logger: LoggerImportPath): Worker {
  return new Worker(__filename, { workerData: { logger });
}

if (!isMainThread) {
  const module: { default: Logger } = await import(workerData.logger);
}

```

```
// no type error, ./path/to/logger exports a Logger.
lib(`${__filename}/path/to/logger');

// this should be a type error: import('not-a-module') is not assignable to { default: Logger };
lib('not-a-module');
```
I don't think you can currently define LoggerImportPath any more precisely than `string` and `import(path: string)` returns `Promise<any>`.

```
// this returns `{ default: Logger}`
await import('path');

// this returns `any`
const wrapper = path => import(path);
const module: any = await wrapper('path')
```

## Use Cases

<!--
What do you want to use this for?
What shortcomings exist with current approaches?
-->
I haven't seen this pattern in any other libraries, but I think it's a good way to pass classes or functions across threads or execution contexts. You can't currently limit the kinds of strings that library uses can pass when a module path is expected.

## Examples

<!-- Show how this would be used and what the behavior would be -->

## Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).
Repository: flutter
Issue: [google_maps_flutter] Compass doesn't show on map rotation until hot reload on Android
Labels: platform-android,customer: crowd,p: maps,package,has reproducible steps,P2,found in release: 2.0,found in release: 2.3,team-android,triaged-android

On Android the compass not showing after map rotation.
When we click on a marker or trigger a hot reloading it start  working.
Repository: pytorch
Issue: SummaryWriter doesn't read comment if log_dir precised
Labels: triaged,module: tensorboard

## 🐛 Bug

Comment from the user is add to log_dir path name only if log_dir is not precised. Saving different file in same folder result creating files 'log_dir/filename.0', 'log_dir/filename.1', .. read as the same file by TB and messing with the graph, histogram, etc.

## To Reproduce

Steps to reproduce the behavior:

1. Create 2 different SummaryWritter with the same log_dir
```
from torch.utils.tensorboard import SummaryWriter
tb1 = SummaryWriter(log_dir = './dir', comment='Training')
tb2 = SummaryWriter(log_dir = './dir', comment='Validation')
```
 
2. Write something with the same name and close : 
```
import numpy as np
for i in range(100):
  tb1.add_scalar('Loss', np.cos(i), i)
  tb2.add_scalar('Loss', np.sin(i),i)
tb1.close()
tb2.close()
```
3. Open tensorboard and see the two file readed as one and the graph bug (line across the graph in this example)


## Expected behavior

The comment must be add out the `if not log_dir` in : 

https://github.com/pytorch/pytorch/blob/master/torch/utils/tensorboard/writer.py#L206-L212
```
class SummaryWriter(object):
    def __init__(self, log_dir=None, comment='', purge_step=None, max_queue=10,
        [...]
        if not log_dir:
            import socket
            from datetime import datetime
            current_time = datetime.now().strftime('%b%d_%H-%M-%S')
            log_dir = os.path.join(
                'runs', current_time + '_' + socket.gethostname() + comment)
        self.log_dir = log_dir 
```

Something like :
```
class SummaryWriter(object):
    def __init__(self, log_dir=None, comment='', purge_step=None, max_queue=10,
        [...]
        if not log_dir:
            import socket
            from datetime import datetime
            current_time = datetime.now().strftime('%b%d_%H-%M-%S')
            log_dir = os.path.join(
                'runs', current_time + '_' + socket.gethostname() )

        self.log_dir = log_dir + '_'  + comment
```

## Additional context

First time reporting something, so your advices are welcome
Repository: opencv
Issue: Get unexpected results when using the setMouseCallback on windows with CV_WINDOW_OPENGL
Labels: category: highgui-gui

I get wrong coordinate points by clicking on the mouse in the window with CV_WINDOW_OPENGL. And the coordinate points obtained from the window without CV_WINDOW_OPENGL are correct.
```
std::vector<cv::Point> vecTemp;
void OnMouseAction(int event, int x, int y, int flags, void *para)
{
    switch (event)
    {
    case CV_EVENT_LBUTTONDOWN:
        vecTemp.push_back(cv::Point2d(x, y));
    }
}
```
```
   cv::Mat cnPerDstFront;
   cv::namedWindow("FRONT", CV_WINDOW_OPENGL | CV_WINDOW_AUTOSIZE);
    cv::imshow("FRONT", cmPerDstFront);
    cv::waitKey(1);
    while (1)
    {
        int key = cv::waitKey(10);
        cv::setMouseCallback("FRONT", OnMouseAction);
        if (key == 'q')
            break;
    }
    vPstFront = vecTemp;
```
```
output vPstFront : [104, 308;105, 738]
```
```
   cv::Mat cnPerDstFront;
   cv::namedWindow("FRONT", CV_WINDOW_AUTOSIZE);
    cv::imshow("FRONT", cmPerDstFront);
    cv::waitKey(1);
    while (1)
    {
        int key = cv::waitKey(10);
        cv::setMouseCallback("FRONT", OnMouseAction);
        if (key == 'q')
            break;
    }
    vPstFront = vecTemp;
```
```
output vPstFront : [104, 313;105, 751]
```
Repository: flutter
Issue: [webview_flutter] Add Windows support
Labels: c: new feature,platform-windows,p: webview,package,a: desktop,P2,team-windows,triaged-windows

I want to implement the function of writing a piece of code to open a web page in android, ios, windows, but this (https://pub.dev/packages/webview_flutter) does not support the windows platform, when can I support it?

## Current status (last updated June 2024)

Blocked on https://github.com/flutter/flutter/issues/31713. There will not be any update on this issue until platform view support has been implemented.

Please [**do not comment to ask for updates or timelines**](https://github.com/flutter/flutter/blob/master/docs/contributing/issue_hygiene/README.md#do-not-add-me-too-or-same-or-is-there-an-update-comments-to-bugs).