# image-background-estimator is an astronomical tool. AI Agent Connect

> image-background-estimator lets your AI client handle complex astronomical image processing tasks. It uses sigma-clipping on pixel data and respects source masks to accurately model sky brightness and instrumental noise. You can generate background maps, check subtraction quality, and analyze spatial gradients directly through your agent.

## Overview
- **Category:** science
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_TUnUjlkoHewgM9pQQKQn79uQeNnIKUcWmrEiwaVl/ai-agent-connect
- **Tags:** astronomy, imaging, statistics, sigma-clipping, sky-background

## Description

You can use this MCP to automate the heavy lifting of astronomical background estimation. Instead of manually calculating noise floors, you let your AI client apply sigma-clipping to pixel data while respecting your existing source masks. This ensures that bright stars or galaxies don't skew your background model. You can build continuous background maps to see how the sky brightness shifts across a frame or look at local statistics to understand regional noise. If you need to verify how well a subtraction worked, the MCP provides diagnostics to check for residual contamination. It's a specialized way to handle spatial gradients and instrumental noise without leaving your coding or analysis environment.

## Tools

### get_background_model
This tool generates a complete suite of background estimation data, including full maps and statistical summaries.

### get_gradient_profile
Use this to analyze how the background gradient changes across the image, specifically looking at its orientation and steepness.

### get_local_statistics
This tool queries specific statistical properties of the background within a localized window of your choosing.

### get_residual_diagnostics
This tool evaluates the quality of your background subtraction to ensure the model is accurate.

## Prompt Examples

**Prompt:** 
```
Generate a background model for this astronomical image using a tile size of 50 and a sigma threshold of 3.0.
```

**Response:** 
```
The background model is ready. The map is smooth, with a global mean intensity of 124.5 units and a standard deviation of 2.1.
```

**Prompt:** 
```
Check the quality of the background subtraction for my image.
```

**Response:** 
```
The residual diagnostics show a contamination index of 0.02, which means the subtraction is clean with minimal source light leakage.
```

**Prompt:** 
```
What is the background intensity at the center of the image (x=500, y=500) with a window size of 20?
```

**Response:** 
```
The local statistics for that window show a mean background value of 125.2 and a median of 125.1.
```

## Capabilities

### Sky Brightness Modeling
Your agent uses sigma-clipping to model the sky brightness while ignoring bright sources.

### Noise Floor Estimation
Your agent calculates instrumental noise levels using pixel data.

### Spatial Gradient Detection
Your agent identifies how the background slope changes across the field of view.

### Subtraction Quality Checks
Your agent runs diagnostics to see if the background removal left unwanted residuals.

### Localized Statistical Analysis
Your agent queries specific regions to find mean and median values in a defined window.

## Use Cases

### Background Subtraction Validation
Use the diagnostics tool to ensure your background removal didn't leave artifacts behind.

### Mapping Sky Gradients
Identify how the sky brightness shifts across a large sensor using gradient profiles.

### Regional Noise Analysis
Check the local statistics in specific areas of an image to understand non-uniform noise.

### Automated Image Pre-processing
Let your agent generate full background models for large datasets using specific tile sizes.

## Benefits

- Sigma-clipping prevents bright sources from corrupting the background model.
- Local window queries allow for precise regional statistical analysis.
- Residual diagnostics provide a metric for subtraction accuracy.
- Automated gradient profiling identifies spatial shifts in sky brightness.

## How It Works

You connect your AI client to the Vinkius-hosted MCP to start processing images.

1. Connect your preferred client like Claude or Cursor to Vinkius.
2. Provide the image data and parameters to your AI agent.
3. Your agent calls the specific tool needed, such as get_background_model.
4. The MCP processes the pixel data using sigma-clipping and masks.
5. Your agent receives the maps or statistics and presents them to you.

## Frequently Asked Questions

**How does this MCP handle bright stars in the image?**
It uses sigma-clipping and source masks to ensure bright objects don't interfere with the background estimation.

**Which AI clients can I use with this MCP?**
You can use any MCP-compatible client, including Claude, Cursor, Windsurf, and VS Code.

**Can I analyze specific parts of an image?**
Yes, you can use the get_local_statistics tool to query statistical properties within a specific window.

**How do I know if my background subtraction was successful?**
You can use the get_residual_diagnostics tool to evaluate the quality and check for contamination.

**Does Vinkius host the MCP?**
Yes, Vinkius hosts and manages the MCP so it is ready to use immediately upon connection.

**How does the estimator handle bright stars in the image?**
The estimator uses the provided mask to identify stars and other celestial objects. During the `get_background_model` process, these pixels are excluded from the sigma-clipping calculation to ensure they do not bias the background estimation.

**Can I check if my background subtraction was successful?**
Yes, you can use the `get_residual_diagnostics` tool. It provides a contamination index and a residual map to help you determine if source light leaked into your background model.

**What kind of spatial information can I extract?**
You can use `get_gradient_profile` to analyze the slope and steepness of the background in specific directions (x, y, or both), which is useful for identifying light pollution or instrumental gradients.
